Reputation: 185
I'm trying to send information over a intent (protectionlevel: dangerous) from application A to application B. I cannot use another protectionlevel since the two apps will use different certificates.
For this, I created two sample apps. But I am not able to send an intent with permission to another application.
Following failure from the 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
Sender has following properties:
<uses-permission android:name="ch.christofbuechi.httpB_perm"/>
In the Manifest
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");
}
As action inside activity
Receiver has following properties:
<permission android:name="ch.christofbuechi.httpB_perm" android:protectionLevel="dangerous"></permission>
and
<receiver android:name=".UserCheckReceiverRequest"
android:permission="ch.christofbuechi.httpB_perm">
<intent-filter>
<action android:name="ch.christofbuechi.android.mybroadcastRequest" />
</intent-filter>
</receiver>
In the Manifest
Actually I dont know where my problem is. I already studied the other stackoverflow-posts regarding this topic. Maybe you can help me too ? Thx
Code can be fetched in complete from here: (Made the samples as easy as possible) https://github.com/ChristofBuechi/appswitch_sample
Upvotes: 0
Views: 1857
Reputation: 1006614
I'm trying to send information over a intent (protectionlevel: dangerous) from application A to application B.
That will only work if Application B is 100% guaranteed to be installed before Application A.
Following failure from the adb-logcat:
That would suggest that Application B (the receiver) was installed after Application A (the sender).
<uses-permission>
for a permission name that Android does not know about is ignored. You have to have the <permission>
element first, to define the name. You might be tempted to have both apps define the same <permission>
, but that will not work on Android 5.0+, because having more than one app (signed by different signing keys) define the same permission opens up some fairly nasty security problems.
Upvotes: 2