aspose file tools*
The moose likes Android and the fly likes how to filter broadcastreceiver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "how to filter broadcastreceiver" Watch "how to filter broadcastreceiver" New topic
Author

how to filter broadcastreceiver

sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
I have a broadcastreceiver in my project.It always run when SMS received.When i get SMS my app starts to run.But i need to filter SMS and for specific SMS i need to run the app.How to do this ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
The filtering would be done by the app. If nothing needs to be done, just quit the app, and the user will never know.


Ping & DNS - updated with new look and Ping home screen widget
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
how to stop the app?
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
I called another class in my Broadcast receiver class.So i can't use Finish() method,as main activity is already onpause.So how can i close all open activities ?
in my case i have two open activities.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
I thought the point was just to show some dialog to the user? Surely it's not necessary to have two activities for that. And if the SMS shouldn't trigger the dialog, there is no need for any activity to be run.
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
I am developing app for special sms.So my requirment if if user received that type of sms i need to do something.else if i received sms i don't need to run the app.Currently i am checking the sms in activity x,but its not main activity.When sms received Broadcast receiver run and called that x activity. If the sms is not required one i can finish x activity,but main activity still there.So how to solve this problem.Shall i call main activity in my broadcast receiver ? or is there a another way to close both x activity and main activity ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
I don't understand why you're starting any activity at all. Why can't the decision of whether or not to do something with the SMS be made in the receiver?

And even if you need to start the "x" activity, why would the main activity be started at all?
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
main activity starts automatically.can we stop it ?if so shall we remove that part from manifest file?
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1031
This is my main class



this is my manifest file


this is my broadcast receiver



I am checking whose sending the message now in broadcastreceiver.But if another one sends a meesage it gives me error


I debug the code ,but it doesn't give any exception,it ends normally.After debug finished the it gives above message.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to filter broadcastreceiver
 
Similar Threads
What Am I Missing About Android Services?
Running Services immediately after the apk is installed on the device.
Activity Expired Time Out From BroadcastReceiver (need ASAP solution)
filter incoming sms android by phone no
Application not run in the background