• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to filter broadcastreceiver

 
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to stop the app?
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
main activity starts automatically.can we stop it ?if so shall we remove that part from manifest file?
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic