Device Permissions and Trip Detection

Implications and Options

Background

Android SDK v8.2.0 (and prior) performs activity polling to obtain confidence level from the OS that a user is performing driving activity. As soon as the confidence level crosses a predetermined threshold, SDK enters into a ‘maybe in drive’ state and also starts collecting GPS and sensor data by launching a foreground service.

Zendrive SDK v8.3.0 supports Android targetSDKVersion 31, which imposes new restrictions on the ability of applications to start the foreground service. Unless certain conditions are met (as described below), applications can no longer arbitrarily start the foreground service. Zendrive SDK can now only start the foreground service upon receiving an activity transition notification from the OS. This however leads to increased incidence of invalid trips, with roughly 0.5 invalid trips per day, per user.

Activity transition notification is a callback that the OS sends after determining a definite change in activity to drive mode. This differs from activity polling which only provides a probability of the user transiting to drive mode.

There are two conditions that SDK can exploit, under which applications can start foreground services at arbitrary instances:

  1. When an application has been granted the overlay permission.

  2. When battery optimization is disabled.

Options for Trip Start Detection

Keeping in mind the above, future SDK versions (v8.3.1 and later) will support the best available option for trip start detection based on permissions granted on the device. The various options are described below with their impact on trip detection and user experience.

#
Permission
Trip Start Trigger
Impact on Trip Detection
Impact on User Experience

A

Battery optimizaton disabled.

Activity polling

Works as before

->(Positive) Non-Intrusive permission

->(Positive) Battery consumption unchanged.

->(Negative) Play store allows only safety applications to disable battery optimization (publisher applications may not qualify).

B

Overlay permission granted.

Activity polling.

Works as before

->(Negative) Intrusive permission: Other secure applications may not work as expected when trip is in progress.

->(Negative) Undocumented usage of this permission. Android may in future remove the ability to arbitrarily start foreground services.

->(Positive) Battery consumption unchanged.

C

Overlay permission not granted AND battery optimization enabled.

Activity transition notification.

Increased invalid trips

(A resolution for increased invalid trips is currently being developed).

->(Positive) No intrusive permission required.

>(Negative) Battery consumption may be higher (not yet measured).

>(Negative) Persistent notification during invalid trips indicating to the user that the application is running in the background. When an actual trip is not in progress, users do not expect to see such a notification.

Selection of the trip start algorithm based on user permissions will happen seamlessly in Zendrive SDK v8.3.1 and later. However developers are recommended to make a choice on which permissions they want to nudge users to grant based on the above description of impact.

Zendrive Recommendation

We recommend the following order of priority: A > C > B, based on impact on trip detection and user experience. Effectively, we recommend that application developers encourage users to disable battery optimization, which has no negative user experience impact. We do not recommend asking users to grant overlay permission which can make the application interfere with other applications.

Was this helpful?