Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
abortBroadcast() doesn't work.
The code is as follows:
C#
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
Updated 11-Mar-11 4:16am
v2

1 solution

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.
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900