问题
I developed an android app and it sends broadcast with a custom permission.
public abstract void sendBroadcast (Intent intent, String receiverPermission)
Now any 3rd party app that has a broadcast receiver and declared the custom permission in their manifest will be able to listen to the broadcast.
Is there a way to control which application can receive the broadcast from my application?
what I'm afraid of is the custom permission gets in the hand of the wrong people and they start creating their own app to listen to my broadcasts.
FYI, the protection-level is set to dangerous.
Thanks,
回答1:
You can set the receiving package name of the 3rd party app in your intent as follow:
intent.setPackage({3rd pary app package name});
context.sendBroadcast(intent);
来源:https://stackoverflow.com/questions/26023829/android-broadcast-to-specific-3rd-party-applications