Can't start server via ADB

JohnC

Expert
Licensed User
Longtime User
Hi,

I had a SGS2 (Android 2.3.4) and I used the below command line to start the "service" in my app:

"adb.exe shell am startservice -n com.mycompany/.servicename"

And it worked fine to remotely start the service in my app from my desktop PC.

But, now I have a S4 and doing the above shell doesn't start the service. It seems there is a permission issue due to the S4 running android 4.2.2

Does anytone have any ideas of a solution?

-John
 

JohnC

Expert
Licensed User
Longtime User
I already got past that security issue...what I meant to say is that I am up to the part in which I able to issue other ADB commands to the device over USB just fine, but it's just trying to start a service that no longer seems to work. When I do a "ADB Shell" and try to start the server with this command:

am startservice -n com.mycompanyname.appname/.servicename

This is what I get:

shell@android:/ $ am startservice -n com.mycompanyname.appname/.servicename
am startservice -n com.mycompanyname.appname/.servicename
Starting service: Intent { cmp=com.mycompanyname.appname/.servicename }
java.lang.SecurityException: Caller uid=2000 is not privileged to communicate wi
th user=-2
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.startService(ActivityManagerNative.j
ava:2927)
at com.android.commands.am.Am.runStartService(Am.java:415)
at com.android.commands.am.Am.run(Am.java:111)
at com.android.commands.am.Am.main(Am.java:82)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
at dalvik.system.NativeStart.main(Native Method)
1|shell@android:/ $

Then I found somewhere that I could use this command instead (with "--user 0" added):

am startservice --user 0 -n com.omnisoft.omnilook/.sync

But that gives this error:

1|shell@android:/ $ am startservice --user 0 -n com.mycompanyname.appname/.servicename
am startservice --user 0 -n com.mycompanyname.appname/.servicename
Starting service: Intent { cmp=com.mycompanyname.appname/.servicename }
Error: Requires permission not exported from uid 10195
shell@android:/ $

So, I can't figure out how to get around this second level of security :(
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
Longtime User
That worked!

Awesome - thank you :)
 
Upvote 0
Top