Main configuration

Permission management

On Android, the user must grant the SDK access to the phone's location and background activity monitoring to enable the trip detection function included in the Trip Analysis component.
The user must additionally accept background execution to avoid the application being stopped by the power saving system.
The Permissions Utils component provides a set of screens to guide the user through the selection of the right options.
Once all permissions have been granted by the user, you are warned by the closure passed in parameter:
Kotlin
Java
1
val permissionViews = arrayListOf(
2
PermissionView.ACTIVITY,
3
PermissionView.LOCATION,
4
PermissionView.BACKGROUND_TASK
5
)
6
7
PermissionsUtilsUI.showPermissionViews(this, permissionViews, object : PermissionViewListener {
8
override fun onFinish() {
9
//Code called when all permissions in the list are properly granted
10
}
11
})
Copied!
1
ArrayList<PermissionView> permissionViews = new ArrayList<>();
2
permissionViews.add(PermissionView.ACTIVITY);
3
permissionViews.add(PermissionView.LOCATION);
4
permissionViews.add(PermissionView.BACKGROUND_TASK);
5
6
PermissionsUtilsUI.INSTANCE.showPermissionViews(this, permissionViews, new PermissionViewListener() {
7
@Override
8
public void onFinish() {
9
//Code called when all permissions in the list are properly granted
10
}
11
});
Copied!
The Permissions Utils component automatically manages the permission request workflow depending on the version of Android installed on the user's smartphone.

SDK diagnosis

The diagnosis screen is divided into four areas:
    1.
    The first displays the status of sensors and permissions.
    2.
    The second contains a quick link to the battery optimization functions.
    3.
    The third displays a contact button to reach support.
    4.
    The fourth section allows you to enable an activity log.
Layout of the diagnosis screen on iOS
The first two areas are always displayed. The third and fourth are optional.
The diagnostic function of the SDK has the following configurations:
    In area 1, the sensors and permissions to be checked are selected automatically except for the Bluetooth sensor. If your application does not use a Bluetooth device or an iBeacon, it is not necessary to monitor the status of the Bluetooth sensor.
    Area 2 is always displayed if the Android version includes power-saving features (introduced from Android 6.0 - API level 23).
    In area 3, it is possible to configure the recipient's email address for the support request or a web address to which the user can be directed.
    Area 4 can be hidden if necessary.
To use the app diagnosis display into your app, you must enter the following lines of code:
Kotlin
Java
1
DriveKitNavigationController.permissionsUtilsUIEntryPoint?.let {
2
it.startAppDiagnosisActivity(this)
3
}
Copied!
1
PermissionsUtilsUIEntryPoint permissionsUtilsUIEntryPoint = DriveKitNavigationController.INSTANCE.getPermissionsUtilsUIEntryPoint();
2
if (permissionsUtilsUIEntryPoint != null) {
3
permissionsUtilsUIEntryPoint.startAppDiagnosisActivity(this);
4
}
Copied!

Bluetooth sensor status check

Access to the Bluetooth sensor is not required. This permission is not requested when the application is first installed.
For natural triggering (i.e. from the phone's sensors), or using an iBeacon, Bluetooth access is not required.
Access to the Bluetooth sensor is required in the two cases described below:
    1.
    To enable automatic start of trip recording from an iBeacon device.
    2.
    To enable automatic start of trip recording from a Bluetooth device.
By default, access to the Bluetooth sensor is not monitored. If you want to monitor the Bluetooth sensor, add the following line after initialization of the module:
Kotlin
Java
1
PermissionsUtilsUI.configureBluetooth(true)
Copied!
1
PermissionsUtilsUI.INSTANCE.configureBluetooth(true);
Copied!

Support Request Management

The user can make a support request if the application does not work properly.
When the user clicks on the support request button, you can choose between two actions:
    1.
    An email will be automatically composed,
    2.
    or a redirection to a web page of your choice will be made.
The email contains the key information to ease the diagnosis of a problem (status of permissions and phone sensors). The recipient's email is configurable, as well as other parameters:
Kotlin
Java
1
PermissionsUtilsUI.configureContactType(ContactType.EMAIL(object : ContentMail {
2
override fun getBccRecipients(): List<String> {
3
//return a list of bcc recipients
4
}
5
6
override fun getMailBody(): String {
7
//return mail body
8
}
9
10
override fun getRecipients(): List<String> {
11
//return list of recipients
12
}
13
14
override fun getSubject(): String {
15
//return mail body message
16
}
17
18
override fun overrideMailBodyContent() {
19
//return true if you want to override the default support mail body
20
}
21
})
Copied!
1
PermissionsUtilsUI.INSTANCE.configureContactType(new ContactType.EMAIL(
2
new ContentMail() {
3
@NotNull
4
@Override
5
public List<String> getRecipients() {
6
//return list of recipients
7
}
8
9
@NotNull
10
@Override
11
public List<String> getBccRecipients() {
12
//return a list of bcc recipients
13
}
14
15
@NotNull
16
@Override
17
public String getSubject() {
18
//return subject
19
}
20
21
@NotNull
22
@Override
23
public String getMailBody() {
24
//return mail body message
25
}
26
27
@Override
28
public boolean overrideMailBodyContent() {
29
//return true if you want to override the default support mail body
30
}
31
}
32
));
Copied!
If you want to redirect the user to a web page instead of composing an email, you have to add the following line:
Kotlin
Java
1
PermissionsUtilsUI.configureContactType(ContactType.WEB(Uri.parse("https://www.docs.drivequant.com")))
Copied!
1
PermissionsUtilsUI.INSTANCE.configureContactType(new ContactType.WEB(Uri.parse("https://www.docs.drivequant.com/")));
Copied!
In this specific case, there is no way to obtain information about authorization and sensor status.
If you do not configure the contact type, this area will be hidden and will not appear on the diagnosis screen.
Kotlin
Java
1
PermissionsUtilsUI.configureContactType(ContactType.NONE)
Copied!
1
PermissionsUtilsUI.INSTANCE.configureContactType(ContactType.NONE.INSTANCE);
Copied!

Activity log

If necessary, the user can enable the activity log. This feature records key events in a file. This data will be helpful to analyse in detail the cause of a problem occurring in the application.
The activity log file is automatically added as an attachment to the support request email (which has been configured in the previous section).
This feature is configurable. By default, this feature is not displayed. To activate it, call the following line:
Kotlin
Java
1
PermissionsUtilsUI.configureDiagnosisLogs(true)
Copied!
1
PermissionsUtilsUI.INSTANCE.configureDiagnosisLogs(true);
Copied!
For more details on the DriveKit logging function, go to the logging page.
Last modified 7mo ago