我试图从应用程序A向应用程序B发送意图(保护级别:危险)信息。我无法使用其他保护级别,因为这两个应用程序将使用不同的证书。带有权限的Android广播,具有保护等级危险
为此,我创建了两个示例应用程序。但是我无法向其他应用程序发送许可意向。
在从亚行logcat的失败:
W/BroadcastQueue:权限拒绝:接收意图{ ACT = ch.christofbuechi.android.mybroadcastRequest FLG = 0×10(已经额外) }为ch。 christofbuechi.httpexampleb/.UserCheckReceiverRequest要求 ch.christofbuechi.httpB_perm由于发送者 ch.christofbuechi.httpexamplea
发送者具有以下属性:
<uses-permission android:name="ch.christofbuechi.httpB_perm"/>
在清单
private void checkUserHA654321() {
Log.d("BroadcastQueue", "send: checkUserHA654321");
Intent intent = new Intent();
intent.setAction("ch.christofbuechi.android.mybroadcastRequest");
intent.putExtra("User", "HA654321");
sendBroadcast(intent, "ch.christofbuechi.httpB_perm");
}
作为动作活动内部
接收机具有以下性质:
<permission android:name="ch.christofbuechi.httpB_perm" android:protectionLevel="dangerous"></permission>
和
<receiver android:name=".UserCheckReceiverRequest"
android:permission="ch.christofbuechi.httpB_perm">
<intent-filter>
<action android:name="ch.christofbuechi.android.mybroadcastRequest" />
</intent-filter>
</receiver>
在清单
其实我不知道我的问题是。我已经研究了关于这个主题的其他stackoverflow-posts。也许你也可以帮助我? THX
的代码可以在完全从这里获取:从应用程序A: (制备的样品尽可能简单) https://github.com/ChristofBuechi/appswitch_sample
谢谢您的回复。但实际上,即使我先安装接收器,它也不起作用。它不理解我对接收者的许可的定义。顺便说一句,我使用的是Android 5.1.1,但我们也在其他设备上测试过 –
@ChristofBuechi:“它不理解我对接收者的权限定义 - 我不知道”它“是什么或者”我的定义是什么接收方许可“的意思。 – CommonsWare
对不起 - 我收到与上面相同的错误。据我所知,我在定义接收器方面做了一些错误。因为我已经将权限添加到了Receiver:UserCheckReceiverRequest。但仍然是同样的失败“权限拒绝” –