I am registering to receive geofence broadcasts and it worked fine with SDK 25. But with SDK 27 this is now broken.
I understand that I cannot register through manifest file to receive implicit broadcasts, but I am registering a class specific broadcast like this:
Intent geofencingIntent = new Intent("GEOFENCE_BROADCAST");
geofencingIntent.putExtra("ID", geofenceId);
geofencingIntent.setClass(context, GeofenceBroadcastReceiver.class);
PendingIntent geofencingPendingIntent = PendingIntent.getBroadcast(context, 1, geofencingIntent, PendingIntent.FLAG_UPDATE_CURRENT);
final Task<Void> geofenceTask = mGeofencingClient.addGeofences(geofencingRequest, geofencingPendingIntent);
However, I am not receiving this broadcast.
Any advice on how why this "explicit" broadcast is not received and the workaround. It is important that the broadcast is received even if the app is not running or active.
Also I fail to understand the logic behind removing this feature. Yes, it is to save battery by preventing applications wake up unnecessarily. But having the ability to receive broadcasts while the app is not running seems like a pretty important feature to me. And encouraging job scheduling, which can only be set for 15mins intervals minimum seems rather restrictive.
I have checked the following answers and do not believe this is a duplicate: Android 8.0 Oreo AlarmManager with broadcast receiver and implicit broadcast ban
Lifetime of BroadcastReceiver with regard to Android O changes
Thank you.