I have to build an app for Android devices (version 2.2 and above) that, among others, will have to implement push notifications. I know that Google offers the C2DM Service for handling theese type of messages. I have also read a tutorial about C2DM and how to implement this.
My problem is, that according to my application requirements, notifications cannot show up to all devices that are registered but only to specific devices that are on a certain range from a specific lat//lng point.
E.g
display push notifications only on devices that are currently located at lat: 40.22 and lng: 22.1 in a range of 10km
So, what I thought was to send the notification along with a lat/lng point and a specific range. Then, the application will check if its current location is in the desired range. If so, the notification will pop on users screen, if not it will vanish.
- What do you think ? Is this a good solution, or can you suggest something better?
- Moreover, in case I keep this solution how can i access the user's location inside my broadcast receiver (who accepts the push notification from C2DM service)?