Is there another way to solve this requirement (other than ProximityAlert())?
On Sunday, March 21, 2010 12:04:45 AM UTC+1, Mark Murphy wrote: > > Prasanna Perera wrote: > > I want the user to enter several addresses and check a check box next > > to each address if she wants to be notified when she come close to > > this particular address. I am trying to use addProximityAlert() to do > > this. I am using the same PendingIntent when calling > > addProximityAlert() for each address. If the user eventually unchecks > > one of the addresses then I want to removeProximityAlert() for this > > address. This removeProximityAlert() takes the PendingIntent as an > > argument. My question is since I am using the same PendingIntent for > > all the addresses, how do I identify the particular address that I > > want to remove from getting proximity alerts? > > You can't. Hence, you need to backpedal on one of your constraints: you > can't use the same PendingIntent for each proximity alert. > > After all, you probably need this anyway. Otherwise, you'll have no good > way of identifying which of your addresses a given Intent is for when > you receive it. > > I am assuming you are creating a PendingIntent on an Intent that uses > the component (e.g., new Intent(this, MyLocationThingy.class)). In that > case, you can generate and tuck in a custom Uri (setData()) or custom > action (setAction()) that is unique relative to your other Intents. That > should not affect the routing -- the component indicates the actual > destination. But you can then: > > -- examine the inbound Intent to figure out which address it is for, > based on the data or action you customized > > -- use this to have distinct PendingIntents that you use for > removeProximityAlert() > > Note that Intent extras are insufficient to keep the PendingIntents > separate, which is why you will need to play with the data or action. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > _The Busy Coder's Guide to *Advanced* Android Development_ > Version 1.3 Available! > > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

