Monday, 29 October 2018

Google's time fence using Awareness API is not reliable

I am building an SDK that is using Google Awareness API.

I have some actions that need to be executed based on different schedules for each day, also when the app is backgrounded - a prefect match for Google's FenceClient or so I thought.

The problem is that the notifications I'm getting are not really related to times I configured in the fence - some times the notifications are minutes/hours late and some times I'm not getting those notifications at all.

What's more weird is that all Google's examples are still using the deprecatedGoogleApiClient.

Technical issues:

  • I defined these two permissions in the manifest:

uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"

uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"

  • Awareness is activated in the Google console and I have the API keys defined in the manifest.
  • I tried to use both (one of them in each time) BroadcastReceiver and JobIntentService using PendingIntent.getBroadcast and PendingIntent.getService. Both of them also defied in the manifest.
  • I'm building the AwarenessFence like this: TimeFence.inIntervalOfDay(dayOfWeek, TimeZone.getDefault(), startTimeOfDayMillis, stopTimeOfDayMillis); start and stop times are in milliseconds since the start of the day.
  • fenceClient.updateFences is completed successfully.


from Google's time fence using Awareness API is not reliable

No comments:

Post a Comment