Using a service to handle multiple intents
I wanted to create a service such that it could keep being launched from the activity with different arguments, and whenever any of the argument conditions is true, it would show notification specific to that argument.
Like if I want the phone to notify me when I'm at a specified location, and i can give multiple such location values, such that if I'm at any of those locations it should tell me and when any one location is reached it should not stop all the other threads checking for the other locations.
I didn't explain it very wel开发者_运维技巧l, but Im getting confused on this.
Any help?
This isn't really how services are designed. What you are looking for sounds much more like at BroadcastReceiver. Using one of these, a single server can send and receive multiple notifications for different situations. Running several services in this case sounds wasteful.
It will help if you can be more clear about your question. If it is about proximity alert, you might get help by looking at Reto's answer here. If it is about creating a service that Android will launch to handle any of a class of Intents, processing them appropriately based upon a specific argument (such as Action), then this might be closer to what you are looking for.
精彩评论