[android-developers] Re: Can we block certain sms messages from reaching the default messaging app?

2012-05-15 Thread Farhan Tariq
I am really stuck at this. Someone please guide me. Thanks

On Tue, May 15, 2012 at 2:47 AM, Farhan Tariq farhan@gmail.com wrote:

 Hi all,

 I aim to make an app that would store sms messages with certain words
 contained in an sms, and stop it from reaching the default messaging app. I
 realize that I need to place a broadcast receiver for sms messages in my
 app, but how do I ensure that If a message contains a KEYWORD, the message
 gets deleted immediately and becomes unaccessible to any other messaging
 app? I am stuck here, so any help is appreciated. Thank you

 Regards,

 Farhan


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Can we block certain sms messages from reaching the default messaging app?

2012-05-15 Thread Chronogps
You have to adjust a priority android:priority attribute on your 
SMS-listening intent-filter


Le 15/05/2012 14:23, Farhan Tariq a écrit :

I am really stuck at this. Someone please guide me. Thanks

On Tue, May 15, 2012 at 2:47 AM, Farhan Tariq farhan@gmail.com 
mailto:farhan@gmail.com wrote:


Hi all,

I aim to make an app that would store sms messages with certain
words contained in an sms, and stop it from reaching the default
messaging app. I realize that I need to place a broadcast receiver
for sms messages in my app, but how do I ensure that If a message
contains a KEYWORD, the message gets deleted immediately and
becomes unaccessible to any other messaging app? I am stuck here,
so any help is appreciated. Thank you

Regards,

Farhan


--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en 


--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Can we block certain sms messages from reaching the default messaging app?

2012-05-15 Thread ChronoGPS



What is important :

abortBroadcast();
filter.setPriority(1000);

It works (I use in my app GPSDetective - you can dl on the android market)

Sample code :


BroadcastReceiver br;

@Override
public void onCreate()
{
super.onCreate();

br = new BroadcastReceiver()
{
@Override
public void onReceive(Context ctx, Intent intent)
{
Bundle extras = intent.getExtras();
SmsMessage[] sms = null;
if (extras != null)
{
//read the content of the SMS and do what you want
if (bKeepThisSMSforMyApp=true)
abortBroadcast();
}
}
};
IntentFilter filter = new IntentFilter();
filter.addAction(android.provider.Telephony.SMS_RECEIVED);
filter.setPriority(1000);
registerReceiver(br, new IntentFilter(filter));
}

Le 15/05/2012 14:23, Farhan Tariq a écrit :

I am really stuck at this. Someone please guide me. Thanks

On Tue, May 15, 2012 at 2:47 AM, Farhan Tariq farhan@gmail.com 
mailto:farhan@gmail.com wrote:


Hi all,

I aim to make an app that would store sms messages with certain
words contained in an sms, and stop it from reaching the default
messaging app. I realize that I need to place a broadcast receiver
for sms messages in my app, but how do I ensure that If a message
contains a KEYWORD, the message gets deleted immediately and
becomes unaccessible to any other messaging app? I am stuck here,
so any help is appreciated. Thank you

Regards,

Farhan


--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en 


--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en