3

I have driving detection setup with the Awareness API for with fences for "starting" and "stopping".

Problem

The app detects that I'm driving about 50% of the time, but often only if/when I turn the screen on while I'm driving. This defeats the purpose of having the ability to perform some useful functions of my application when they are driving.

Secondly, I also often find that I come back to my phone that's been sitting on a table, completely still, has both notifications showing for "starting" and "stopping" driving.

so, TL;DR... Driving detection has really high false positives, and poor accuracy when actually driving.

Has anyone else noticed this? Anything to resolve it?

Code

It's pretty straight forward, setup with a broadcast receiver (I've also used a service PendingIntent with the same results):

Awareness.FenceApi.updateFences(
            mGoogleClient,
            new FenceUpdateRequest.Builder()
                    .addFence(ActivityChangeReceiver.FENCE_START_DRIVING,
                              DetectedActivityFence.starting(DetectedActivityFence.IN_VEHICLE),
                              ActivityChangeReceiver.getStartDrivingPendingIntent(MainActivity.this))
                    .addFence(ActivityChangeReceiver.FENCE_STOP_DRIVING,
                              DetectedActivityFence.stopping(DetectedActivityFence.IN_VEHICLE),
                              ActivityChangeReceiver.getStopDrivingPendingIntent(MainActivity.this))
                    .build())
                      .setResultCallback(status -> {
                          if (status.isSuccess()) {
                              Timber.i("Fences successfully registered.");
                              registerReceiver(new ActivityChangeReceiver(), new IntentFilter(ActivityChangeReceiver.FENCE_RECEIVER_ACTION));
                          }
                          else {
                              Timber.e("Fences could not be registered: %s", status);
                          }
                      });

When I get the BroadcastReceiver invoked, I just show a notification for each: starting and stopping

Neil MacMillan
  • 208
  • 2
  • 8

0 Answers0