Android 经许可广播,protectionLevel 危险
Android Broadcast with permission, protectionLevel dangerous
我正在尝试通过意图(保护级别:危险)从应用程序 A 向应用程序 B 发送信息。我不能使用其他保护级别,因为这两个应用程序将使用不同的证书。
为此,我创建了两个示例应用程序。但是我无法将经过许可的意图发送给另一个应用程序。
来自 adb-logcat 的失败:
W/BroadcastQueue: Permission Denial: receiving Intent {
act=ch.christofbuechi.android.mybroadcastRequest flg=0x10 (has extras)
} to ch.christofbuechi.httpexampleb/.UserCheckReceiverRequest requires
ch.christofbuechi.httpB_perm due to sender
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");
}
作为内部动作 activity
接收器具有以下属性:
<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>
在清单中
其实我不知道我的问题出在哪里。我已经研究了关于这个主题的其他 Whosebug 帖子。也许你也可以帮助我?谢谢
可以从这里获取完整的代码:
(使样品尽可能简单)
https://github.com/ChristofBuechi/appswitch_sample
I'm trying to send information over a intent (protectionlevel: dangerous) from application A to application B.
仅当应用程序 B 100% 保证在应用程序 A 之前安装时才有效。
Following failure from the adb-logcat:
这表明应用程序 B(接收方)是在应用程序 A(发送方)之后安装的。
<uses-permission>
对于 Android 不知道的权限名称将被忽略。您必须先有 <permission>
元素才能定义名称。您可能想让两个应用程序定义相同的 <permission>
,但这不适用于 Android 5.0+,因为有多个应用程序(由不同的签名密钥签名)定义相同的权限会打开一些相当讨厌的安全问题。
我正在尝试通过意图(保护级别:危险)从应用程序 A 向应用程序 B 发送信息。我不能使用其他保护级别,因为这两个应用程序将使用不同的证书。
为此,我创建了两个示例应用程序。但是我无法将经过许可的意图发送给另一个应用程序。
来自 adb-logcat 的失败:
W/BroadcastQueue: Permission Denial: receiving Intent { act=ch.christofbuechi.android.mybroadcastRequest flg=0x10 (has extras) } to ch.christofbuechi.httpexampleb/.UserCheckReceiverRequest requires ch.christofbuechi.httpB_perm due to sender 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");
}
作为内部动作 activity
接收器具有以下属性:
<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>
在清单中
其实我不知道我的问题出在哪里。我已经研究了关于这个主题的其他 Whosebug 帖子。也许你也可以帮助我?谢谢
可以从这里获取完整的代码: (使样品尽可能简单) https://github.com/ChristofBuechi/appswitch_sample
I'm trying to send information over a intent (protectionlevel: dangerous) from application A to application B.
仅当应用程序 B 100% 保证在应用程序 A 之前安装时才有效。
Following failure from the adb-logcat:
这表明应用程序 B(接收方)是在应用程序 A(发送方)之后安装的。
<uses-permission>
对于 Android 不知道的权限名称将被忽略。您必须先有 <permission>
元素才能定义名称。您可能想让两个应用程序定义相同的 <permission>
,但这不适用于 Android 5.0+,因为有多个应用程序(由不同的签名密钥签名)定义相同的权限会打开一些相当讨厌的安全问题。