I have an app where I want to build 2 different flow\'s in:
1.b App show\'s an alertbox where user can choose to go to
I'd just write another BroadcastReceiver like this:
public class MainActivityBroadcastReceiver extends BroadcastReceiver {
public MainActivityBroadcastReceiver(Activity mainActivity) {
}
@Override
public void onReceive(Context context, Intent intent) {
Toast toast = Toast.makeText(context, "hola", Toast.LENGTH_LONG);
toast.show();
abortBroadcast();
}
}
and then in the MainActivity I'd override the methods and then I don't receive the notification so I intercept the `Intent~ and abort the other broadcast:
@Override
protected void onPause() {
unregisterReceiver(mainActivityBroadcastReceiver);
super.onPause();
}
@Override
public void onResume() {
IntentFilter filter = new IntentFilter("com.google.android.c2dm.intent.RECEIVE");
filter.setPriority(1);
registerReceiver(mainActivityBroadcastReceiver, filter);
super.onResume();
}