Skip to content

Geofencing

Alexander Boldyrev edited this page Dec 28, 2023 · 2 revisions

DEPRECATED

Geofencing part of the library has been deprecated and will not be maintained further. Last library version with geofencing support is 2.5.1.

It is possible to enable geofencing engine inside Mobile Messaging. In this case geofencingEnabled shall be set to true in initialization configuration. Appropriate permissions should be also requested or configured for your application prior to initialization of library. Initialization will fail if there are no appropriate permissions.

Android

Make sure that location permission is added to android configuration in "config.xml":

<widget ... xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    <platform name="android">
        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        </config-file>
    </platform>
    ...
</widget>

After that Mobile Messaging plugin can be initialized with geofencing enabled. Be aware that the plugin might request runtime permissions by itself on Android 6.0 and above right before initialization.

Huawei

Add this code at the beginning platforms/android/app/build.bradle:

apply plugin: 'com.huawei.agconnect'

iOS

Make sure to include NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription keys in your app’s Info.plist. These keys let you describe the reason your app accesses the user’s location information. Mobile Messaging library will request location permission by itself. iOS will use the values of these keys in the alert panel displayed to the user when requesting permission to use location services.

Important: For iOS 11 compatibility you are additionally required to include the NSLocationAlwaysAndWhenInUseUsageDescription key in your app's Info.plist file. If this key is not present, authorization requests fail immediately (Documentation).

Clone this wiki locally