Comment on page
Android Geofence & Location
Netmera SDK does not gather any location information from the device:
By default, Netmera SDK does not gather any location information from the device. If you want to use Netmera features requiring location information such as geofence messages and filtering target users by location, you must enable location tracking for your application.
Add following two location permissions to your AndroidManifest file.
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
Only for Android 6.0 (API Level 23) and later, location permission must be requested while app is running depending to your app's targetSdkVersion. For more info please refer to this link. The implementation of runtime permission request is complicated but Netmera has already have permission request flow for location permissions. All you have to do is calling following method in some appropriate place of your app's flow.
//Request runtime permission for location
After you call that method, default permission dialog will be shown to the user if app has not already been granted the location permission. After the user allows, Netmera will perform location operations according to your settings on Netmera Dashboard.
Setting max regions for geofence:
You can set max regions for Geofence with setNetmeraMaxActiveRegions method. If you set max active regions' number greater than 95 or smaller than 0, it will be set as the default which is 95.
For using location to target your users, you should enable Location History from the web panel. In order to do that, follow these steps:
Developers -> App Info -> App Config -> Location History Enabled
Done Now, your app can use location features of Netmera SDK.
Go to your app on Netmera Dashboard make following configurations according your needs:
- Enable location history for location tracking
- Add some Geofence places for region tracking
For applications that require hardware, you must use the ** ** declaration to view the app in the store on devices that do not have this feature.
To use geofence or location-based push services via Netmera, location hardware is required in the devices. You need to add the following GPS declaration into your manifest file.