我正在處理消息的發送和接收,我通過廣播接收器收到了許多消息接收的答案,但是沒有發送消息的解決方案。如何檢測發送的消息?
<receiver
android:name="com.test.services.MessageReciver"
android:enabled="true"
android:permission="android.permission.BROADCAST_SMS" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_DELIVER" />
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
public static final String ACTION_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
public static final String ACTION_SENT = "android.provider.Telephony.SMS_DELIVER";
Context context;
@Override
public void onReceive(Context context, Intent intent) {
// this section works only when message received on in case of sent
}
但是,只有消息的廣播接收器接收到的工作不是爲發送的消息。
感謝,但我發送從默認消息應用程序的消息。我想檢測從設備默認應用程序發送currnlty的消息,而不是來自定製應用程序。 –
OP不想發送短信,他想要檢測何時發送短信 –