0

I'm trying to broadcast an adb-command to a broadcast-receiver. This would be a very simple task, but the braodcast-receiver has:

android:exported="false"

On the offical android.developer website, it says:

If "false", the only messages the broadcast receiver can receive are those sent by components of the same application or applications with the same user ID.

So I'm trying to add the user ID to the broadcast. My approach by now is the following adb command:

> adb shell am broadcast -a com.example.action -n com.android.package/.receiverName --user "User_ID"

I get Error: Invalid int: "User_ID" in the cmd under Windows. This app is a System-app, more precise, it is the default Phone-App. I thought an Adb command is a system broadcast by default. My question therefor is: Is there any way to to send the User ID with the broadcast or to access not exported actions? Is there maybe a difference between the User_ID of the manifest and the User_ID of the am broadcast. Thanks in advance

P.S: I haven't got any root access, because it should work for a lot of devices without rooting everyone. As final result I want to accept an incoming videocall as Audiocall.

Foster
  • 25
  • 2
  • 9

1 Answers1

0

There are totally different user.

The first "user", in android website, is the user id in linux system, like root,system,u0_a58(10058). Every APK has it's user id, unless in share UID condition.

The second "user", in the am command, is the user stand for people who using this phone, like administrator, guest.
(You can add Guest user in Android Tab, but you can not do it in a Android phone, due to some legal stuff.)

The answer: there is no way to access not exported component from a non-root shell or 3rd APK.

Swing
  • 858
  • 1
  • 8
  • 21
  • Thanks, I was looking for an answer like this, if there is a difference between those users. But is there really no way to install an apk with the same user id like the phone app for example?? Which then is able to broadcast this action to a system app? – Foster Dec 03 '15 at 08:32
  • @Foster There is a way to let two APK has the same user id, two steps:1,use android:sharedUserId in AndroidManifest.xml; 2, the two APK need to be signed by the same certificate. [http://developer.android.com/guide/topics/manifest/manifest-element.html#uid](http://developer.android.com/guide/topics/manifest/manifest-element.html#uid) – Swing Dec 04 '15 at 01:09
  • Thank you. Well that means if I'm not the author of the apps, I won't be able to access them, in an easy way. As for the same certificate I will need the username and password, right? – Foster Dec 04 '15 at 08:26
  • The cerificate here is more complicate,check this out: http://developer.android.com/tools/publishing/app-signing.html – Swing Dec 04 '15 at 08:36