-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to start service via ADB / Shell #17
Comments
The Intent to start the service requires these two parameters (the target server IP address and port). You can check out the Java code here: Android-GPSd-Forwarder/app/src/main/java/io/github/tiagoshibata/gpsdclient/MainActivity.java Lines 195 to 206 in fced5fc
I never tried running it through
|
I tested with Android 7, and the complete command as root user is: am startservice --user 0 \
-e io.github.tiagoshibata.GPSD_SERVER_ADDRESS 198.51.100.1 \
--ei io.github.tiagoshibata.GPSD_SERVER_PORT 6000 \
io.github.tiagoshibata.gpsdclient/.GpsdForwarderService The command for newer Androids (IIRC 9 and newer) should use am start-foreground-service --user 0 -n \
-e io.github.tiagoshibata.GPSD_SERVER_ADDRESS 198.51.100.1 \
--ei io.github.tiagoshibata.GPSD_SERVER_PORT 6000 \
io.github.tiagoshibata.gpsdclient/.GpsdForwarderService The Thanks for your app :-) |
Unfortunately, it is not possible to start the foreground service on Android 11 as is, without root. Fortunately I was able to decompile the .apk and export the service by modifying the manifest. It's also not possible to start it without user interaction of some kind.. i.e. device needs to be unlocked for application to come to front and service to start. Thank you for all the input, it did not go unoticed! Here is a small script I have devised for use in Termux with the modified apk.
|
Hello and happy New Year! I am trying to start the service using a script so it's possible to to use GPSd inside my chroot without interacting with device directly. When running
am start-foreground-service --user 0 -n io.github.tiagoshibata.gpsdclient/.GpsdForwarderService
the app immediately produces an ANR. Do you know of a way I can start the service using adb shell or command line?Here is a snippet from logcat
01-02 20:23:55.183 E/AndroidRuntime(11063): java.lang.RuntimeException: Unable to start service io.github.tiagoshibata.gpsdclient.GpsdForwarderService@78802ee with Intent { cmp=io.github.tiagoshibata.gpsdclient/.GpsdForwarderService }: java.lang.RuntimeException: GpsdClientService requires parameters io.github.tiagoshibata.GPSD_SERVER_ADDRESS and io.github.tiagoshibata.GPSD_SERVER_PORT
The text was updated successfully, but these errors were encountered: