If location permission is not granted by the user, Trip Analysis SDK will not work.
Activity Recognition Permission
For device running Android 10 and above, it's required to ask the user for activity recognition permission. Find below an example of how to ask the permission:
If activity recognition permission is not granted by the user, Trip Analysis component will not work.
Battery optimization
It is required to ask the user to disable battery optimization for your app. Without battery optimization disabled, Trip Analysis SDK will not work properly.
The SDK usage is included into acceptable use cases for requesting or being on the Battery Optimizations exceptions whitelist. For more information you can read the Android developer documentation on this topic.
Call the following code after explaining to the user why disabling battery optimization is required:
If battery optimization is enabled, trip recording will not work.
Some manufacturers add other battery optimizations. You can find tutorials on how to disable these battery optimizations for main Android device manufacturers here.
Nearby Devices Permission
For devices running Android 12 and above, it's required to ask the user for Nearby Devices permission. Find below an example of how to ask Nearby Devices permission:
If Nearby Devices permission is not granted by the user, Trip Analysis component won't work correctly.
Notification Runtime Permission
For devices running Android 13 and above, it's required to ask the user for Notification runtime permission. If the permission is not granted, the user will not receive notifications.
Find below an example of how to ask the Notification permission:
First, declare the permission in your Manifest app file:
funcheckNotificationPermission(activity: Activity, requestCode: Int) {if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {val isNotificationPermissionAuthorized = ContextCompat.checkSelfPermission(activity, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTEDif (!isNotificationPermissionAuthorized) {if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.POST_NOTIFICATIONS)) {// Display a message to explain why the user need to grant the permission } else { ActivityCompat.requestPermissions(activity,arrayOf(Manifest.permission.POST_NOTIFICATIONS), requestCode) } } }}
publicvoidcheckNotificationPermission(Activity activity,int requestCode) {if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.TIRAMISU) {boolean isNotificationPermissionAuthorized =ContextCompat.checkSelfPermission(activity,Manifest.permission.POST_NOTIFICATIONS) ==PackageManager.PERMISSION_GRANTED;if (!isNotificationPermissionAuthorized) {if (ActivityCompat.shouldShowRequestPermissionRationale(activity,Manifest.permission.POST_NOTIFICATIONS)) {// Display a message to explain why the user need to grant the permission } else {ActivityCompat.requestPermissions(activity,newString[] { Manifest.permission.POST_NOTIFICATIONS }, requestCode); } } }}
Full-screen intent permission
For Android 14 devices and above, it is now necessary to ask the user for this permission to display full screen notification for the Crash Detection feedback feature.
If the permission is not granted, the user will not receive full-screen notifications when the smartphone is locked, but instead an expanded heads-up notification on lockscreen. Find below an example of how to ask the full-screen intent permission:
First, declare the permission in your Manifest app file: