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 perfect 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 - sometimes the notifications are minutes/hours late and sometimes I'm not getting those notifications at all.
What's weirder 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.