I want to use my phone as a GPS receiver on Debian. I can connect the phone via usbc and wifi, but I have no Bluetooth on the pc. Anyone can explain how to get GPS data from the phone? The best thing would be have it recognized as a GPS receiver
2 Answers
Requirements:
- In PC, install adb package with
sudo apt install adb. Or download it directly from this link. - In Android, enable Developer options and USB debugging.
- Connect Android with USB cable, run
adb devicesin terminal, allow USB debugging prompt in phone.
Procedure:
- In Android, enable GPS. Then open Settings > About Phone > tap five times on Kernel version > Single Item Test > GPS.
- In PC, Open terminal in PC. Clear all previous log with
adb logcat -c To filter out the GPS logs only, run any of the command below:
- For all GPS related logs:
adb logcat | grep -i gps - For GPS tag:
adb logcat "*:S Gps_test_Activity"
- For all GPS related logs:
The output will show 1. Number of Satellites (num) 2. Satellite ID (prn) 3. Elevation 4. Azimuth. For further filtering, use grep, awk, sed tools.
-
Thank you. Will this make the output usable in other programs which require GPS?Kodeeo– Kodeeo2019-06-01 15:07:52 +00:00Commented Jun 1, 2019 at 15:07
-
@Kodeeo If a program need Latitude and Longitude the it has to be calculated from Azimuth and Elevation. Or use Location class from Android API.Biswapriyo– Biswapriyo2019-06-02 11:47:43 +00:00Commented Jun 2, 2019 at 11:47
more alternatives:
- using the Geoclue service + GeoclueShare app
- using the
gpsdservice + BlueNMAE app
see also this question
