LocationManager.AddProximityAlert Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets a proximity alert for the location given by the position (latitude, longitude) and the given radius.
[Android.Runtime.Register("addProximityAlert", "(DDFJLandroid/app/PendingIntent;)V", "GetAddProximityAlert_DDFJLandroid_app_PendingIntent_Handler")]
public virtual void AddProximityAlert (double latitude, double longitude, float radius, long expiration, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("addProximityAlert", "(DDFJLandroid/app/PendingIntent;)V", "GetAddProximityAlert_DDFJLandroid_app_PendingIntent_Handler")>]
abstract member AddProximityAlert : double * double * single * int64 * Android.App.PendingIntent -> unit
override this.AddProximityAlert : double * double * single * int64 * Android.App.PendingIntent -> unit
Parameters
- latitude
- Double
the latitude of the central point of the alert region
- longitude
- Double
the longitude of the central point of the alert region
- radius
- Single
the radius of the central point of the alert region in meters
- expiration
- Int64
expiration realtime for this proximity alert in milliseconds, or -1 to indicate no expiration
- pendingIntent
- PendingIntent
a PendingIntent
that will sent when entry to or exit from the
alert region is detected
- Attributes
Exceptions
if AccessFineLocation permission is not present
Remarks
Sets a proximity alert for the location given by the position (latitude, longitude) and the given radius.
When the device detects that it has entered or exited the area surrounding the location, the given PendingIntent will be fired.
The fired intent will have a boolean extra added with key #KEY_PROXIMITY_ENTERING
. If the value is true, the device is entering the proximity region; if false, it is exiting.
Due to the approximate nature of position estimation, if the device passes through the given area briefly, it is possible that no Intent will be fired. Similarly, an intent could be fired if the device passes very close to the given area but does not actually enter it.
Before API version 17, this method could be used with android.Manifest.permission#ACCESS_FINE_LOCATION
or android.Manifest.permission#ACCESS_COARSE_LOCATION
. From API version 17 and onwards, this method requires android.Manifest.permission#ACCESS_FINE_LOCATION
permission.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.