File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to filter broadcastreceiver

 
sam liya
Ranch Hand
Posts: 1240
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The filtering would be done by the app. If nothing needs to be done, just quit the app, and the user will never know.
 
sam liya
Ranch Hand
Posts: 1240
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to stop the app?
 
sam liya
Ranch Hand
Posts: 1240
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 liya
Ranch Hand
Posts: 1240
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 liya
Ranch Hand
Posts: 1240
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
main activity starts automatically.can we stop it ?if so shall we remove that part from manifest file?
 
sam liya
Ranch Hand
Posts: 1240
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic