简体   繁体   中英

Proximity Alert Service in background

I am developing an application in which i need a proximity alert when the user enter a specific location with a given Latitude, longitude and radius. I had written a service which implements LocationListener and listen by a BroadcastReceiver to put a notification when the user is in the proximity. Everything working fine, but when i am deleting the application from the recent application list it no more sending the broadcast intent. But according to my actual requirement even if the user delete the application from the recent list or the application is not in the background i need to get a notification when the user is in the particular latitude and longitude with the given radius.

I think you are doing it wrong. I would be sure if provided some code in your post.

You must use LocationManager for such requirements. Read documentation here . The first lines say

This class provides access to the system location services. These services allow applications to obtain periodic updates of the device's geographical location, or to fire an application-specified Intent when the device enters the proximity of a given geographical location.

Use its API addProximityAlert to register for an proximity alert even when your app is not running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM