If using the location-aware implementation of nudge, you will need to prompt the app user to allow location permissions, even when the app is not being used. If your app does not already prompt for this level of location permission, you can use the method below in the place where you would like to prompt the user. This is typically done early on in the app experience. If the user has not yet accepted push notifications permissions, then this function will not prompt for location permissions.
myNudge.promptUserForLocationPermissions(applicationContext, notiTitle, notiText, resourceId, disclosureDialogEnabled, backgroundDisclosureDialogEnabled)
Key:
myNudge: This would be your instance of nudge created when initializing the libraryapplicationContext: your app’s current Application ContextnotiTitle(String): Override default persistent notification title for background location usage. Example: "Monitoring for activity"notiText(String): Override default persistent notification text for background location usage. Example: "Keeping you informed of important notices"resourceId(int): ID of icon to be displayed in nudge notifications. NOTE: The icon must be white and have a transparent background (.png)disclosureDialogEnabled(Boolean - default = true):- If
set = True, the library will show a prominent disclosure text and prompt the user for foreground location permissions when applicable - If
set = False, the library will not display a disclosure nor prompt for foreground permissions. In that case it is assumed that the integrator app is handling prompting for foreground location permissions - Version specifics:
- For Android 10 this parameter is used to request both foreground and background location permissions
- For Android 9 and below this parameter is used to request location permissions (there is no foreground/background distinctions)
- If
backgroundDisclosureDialogEnabled(Boolean - default = true):- If
set = True, the library will show a prominent disclosure text and prompt the user for background location permissions when applicable - If
set = False, the library will not display a disclosure nor prompt for background permissions. In that case it is assumed that the integrator app is handling prompting for background location permissions - Version specifics:
- For Android 10 and below this parameter is not used and has no effect
- If
Prominent Disclosure
Submission to the Google Play store requires apps to display a prominent disclosure for why the app requires persistent location tracking. By default nudge displays a dialog handling this requirement. If you'd like to customize the disclosure messaging, contact us and we will be happy to assist you.
Note when refactoring an earlier integration
Please note that it is no longer necessary to override onRequestPermissionsResult to pass location permission information back to the nudge library. This process is now handled internally in the nudge library.
Comments
0 comments
Article is closed for comments.