Manifest:
<receiver android:name=".GpsLocationReceiver">
<intent-filter>
<action android:name="android.location.PROVIDERS_CHANGED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
BroadcastReceiver:
public class GpsLocationReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "onReceive...");
if(intent.getAction().matches("android.location.PROVIDERS_CHANGED")) {
Log.d(TAG, "GPS provider changed...");
EventBus.getDefault().postLocal(intent.getAction());
}
}
}:
Log.d(TAG, "onReceive...");
to this ->Log.d(TAG, intent.getAction();
to see why is called twice :) – Mongolian