I'm triggering a BoradcastReceiver when receiving a location update
PendingIntent pendingIntent = PendingIntent
.getBroadcast(this, 54321, intent, PendingIntent.FLAG_CANCEL_CURRENT);
LocationServices.FusedLocationApi.requestLocationUpdates(this.mGoogleApiClient,
mLocationRequest, pendingIntent);
And my Receiever
public static class LocationReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
boolean hasLocation = LocationResult.hasResult(intent);
}
}
If I run the above code eveything works fine hasLocation is always true, perfect.
But If I wish to pass some variable to the Receiver so I do:
Intent intent = ..
intent.putExtra("test", "hello");
PendingIntent pendingIntent = PendingIntent
.getBroadcast(this, 54321, intent, PendingIntent.FLAG_CANCEL_CURRENT);
Bit now in the reciever LocationResult.hasResult(intent); is always false
Is this a bug? Is there a workaround to this? How can I pass variable to the reciever?