Click here to Skip to main content
12,898,174 members (67,775 online)
Rate this:
Please Sign up or sign in to vote.
See more: Mobile Android
abortBroadcast() doesn't work.
The code is as follows:
<br />
<pre lang="cs">public class SMSReceiver1 extends BroadcastReceiver<br />
{<br />
    @Override<br />
    public void onReceive(Context context, Intent intent)<br />
    <br />
         this.abortBroadcast();<br />
		Toast tag = Toast.makeText(context, "Abort Broadcast!!!", Toast.LENGTH_LONG);<br />
		tag.setDuration(30);<br />;<br />
</pre><br />

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
Updated 11-Mar-11 4:16am

1 solution

Rate this: bad
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

For example, look at the getSmsDetails method in the SMSPopUp application.
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
Web01 | 2.8.170424.1 | Last Updated 20 May 2013
Copyright © CodeProject, 1999-2017
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