I am working on an application that we hope will be able to block incoming text messages (depending on user settings), but I am having problems detecting incoming messages.
Could you take a look at my codes and tell me what I'm doing wrong? I look through other questions similar to this, but I cannot find any detailed answer or sufficient information for the link.
import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; public class SmsReceiver extends BroadcastReceiver{ public void onReceive(Context context, Intent intent) { if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){ Bundle bundle = intent.getExtras(); if (bundle != null){ abortBroadcast(); } } } }
Here is my manifest
<receiver android:name=".listener.SmsReceiver"> <intent-filter android:priority="100"> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver>
I am following the MobiForge tutorial ( http://mobiforge.com/developing/story/sms-messaging-android ) as well as questions here:
How to block an incoming message in android?
Android - listen to incoming SMS messages
Can someone point me in the right direction? I would appreciate.
source share