if you ask me - I think that it’s best for your situation to create your own filter of intentions (as you spoke in your question), because if you announce your activity to receive a system built into the broadcast, it means. so what is the point using this built-in translation if you "break his contract" from a system point of view and want to ignore it in some cases?
if you decide to use this built-in filter anyway, although I suggested that the way to achieve what you want is:
register the recipient not in the manifest, but in the onCreate () method of your first run and unregister in onDestroy ().
thus, your activity will not be registered if none of your actions is in the foreground - this is close to the state which application is close to the point of view of users.
if you don’t know how to do it like this:
private BroadcastReceiver mMyCustomReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) {
source share