Android广播到特定的第三方应用程序 [英] Android broadcast to specific 3rd party applications

查看:297
本文介绍了Android广播到特定的第三方应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个android应用程序,它以自定义权限发送广播.

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.

谢谢

推荐答案

您可以按以下方式设置第三方应用程序的接收包名称:

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

这篇关于Android广播到特定的第三方应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆