简体   繁体   English

Android广播到特定的第三方应用程序

[英]Android broadcast to specific 3rd party applications

I developed an android app and it sends broadcast with a custom permission. 我开发了一个Android应用程序,它通过自定义权限发送广播。

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, 谢谢,

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM