Android.Locations.LocationManager.AddProximityAlert Method
Set a proximity alert for the location given by the position (latitude, longitude) and the given radius.

Syntax

[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 intent)

Parameters

latitude
the latitude of the central point of the alert region
longitude
the longitude of the central point of the alert region
radius
the radius of the central point of the alert region, in meters
expiration
time for this proximity alert, in milliseconds, or -1 to indicate no expiration
intent
a PendingIntent that will be used to generate an Intent to fire when entry to or exit from the alert region is detected

Exceptions

TypeReason
Java.Lang.SecurityExceptionif NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#ACCESS_FINE_LOCATION permission is not present

Remarks

Set 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 used to create an Intent to be fired.

The fired Intent will have a boolean extra added with key LocationManager.KeyProximityEntering. 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.

After the number of milliseconds given by the expiration parameter, the location manager will delete this proximity alert and no longer monitor it. A value of -1 indicates that there should be no expiration time.

Internally, this method uses both LocationManager.NetworkProvider and LocationManager.GpsProvider.

Before API version 17, this method could be used with NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#ACCESS_FINE_LOCATION or NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#ACCESS_COARSE_LOCATION. From API version 17 and onwards, this method requires NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#ACCESS_FINE_LOCATION permission.

[Android Documentation]

Requirements

Namespace: Android.Locations
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1