Click here to Skip to main content
12,351,853 members (33,836 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Mobile Android
abortBroadcast() doesn't work.
The code is as follows:
public class SMSReceiver1 extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    
         this.abortBroadcast();
		Toast tag = Toast.makeText(context, "Abort Broadcast!!!", Toast.LENGTH_LONG);
		tag.setDuration(30);
		tag.show();

My intention is to block incoming sms message. But after abort function, incoming message is still shown to user as I used a Toast.

Toast.makeText(context, str, Toast.LENGTH_SHORT).show();

How do I do?
Please, reply me ASAP.
Have a nice day you all.
Posted 11-Mar-11 3:54am
Edited 11-Mar-11 4:16am
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I don't know how you can block an sms message before it is received.

However, reading a SMS via Android can be done after it is received can be done using a query on the SMS inbox. The SMSPopUp application for Android does this and more. The sourcecode of this application can be found here https://code.google.com/p/android-smspopup/

For example, look at the getSmsDetails method in the SMSPopUp application.
  Permalink  
v2
Comments
Nauman Zubair 17-May-13 0:57am
   
Above link is not working, please provide alternate link if possible,
Patrick Kalkman 20-May-13 5:50am
   
Done, Thanks for you comment.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 20 May 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100