Skip to content

Location Based Notifications

Android

Add those permissions in your AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

When you want to start the radar for geofences and beacons, you call this method:

// call this when you are given the proper permission for scanning (ACCESS_FINE_LOCATION)
NearItManager.Instance.StartRadar();
// to stop the radar call the method nearItManager.stopRadar()

VERY IMPORTANT Call the method only AFTER you are given the ACCESS_FINE_LOCATION permission.

The SDK creates a system notification for every background recipe. On the notification tap, your launcher activity will start.

iOS

Before you start:

  • You must add the NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in the project Info.plist under the section Source.
  • You will need to get Always authorization from an instance of CLLocationManager

When you want to start the radar for geofences and beacons, call the Start method.
Remember, you can only start the radar AFTER you are given the proper permissions:

CLLocationManager LocationManager = new CLLocationManager();

LocationManager.AuthorizationChanged += (s, e) =>
{
    if (e.Status == CLAuthorizationStatus.AuthorizedAlways)
        NearBridgeiOS.Start();
};

LocationManager.RequestAlwaysAuthorization();

After the radar has been started, you should receive our notification based on you NearIT recipes.