termux-api
termux-api copied to clipboard
Termux-location not working via bash
Using termux-location at the command line (interactively) works fine. But when I put commands into a bash file, I get no output or null.
For example, bash code in a file like this -
x=$(termux-location -p network) x=$(echo $x | jq .text) echo $x
Works correctly interactively, but does not work when running in bash file with proper shebang. Any ideas?
I'm sometimes getting nothing when I execute termux-location -p network on interactive shell. Command execution takes long time, more than 1 minute.
Sometimes it is slow interactively. When "termux-location" fails somehow, I change provider to network; that seems to work pretty well. But then I realized it only works interactively. I want to make some kind of GPS service, which will run as a script. All my other scripts are working great. I think there is an issue here.
The script worked once at 1AM-ish. One-off kind of thing. Fickle location service, API, or rate-limited? I doubt a rate limit, because it can work interactively (at least sometimes it does). It seems to be a fickle location service, whatever that means.
Any update on this? I am also trying to use it, but I don't even have any response from the interactive mode with neither of the provider settings...I do not even dare to ask for the -r last as there is no last "measurement" in terms of termux.
I am trying to use it on two phones, but no success.
Also checked android app permissions....termux does not even ask for location permission - only storage (weird).
Anything I miss here? Thanks
Just realized I had an older verison. Still, after upgrading to the latest one from f-droid, i am still having the same issue :|
okay, sorry for the confusion, got it working. I did not know that termux-api is also an android/apk file I have to download and install from f-droid, too. Then, within termux after installing termux-api package, all API functions started to work.
Thank you
How it is possible that I'm getting wrong speed outputs when calling via shell "termux-location -p gps" and by wrong I mean like the number 20 km/h instead of 90 km/h ? Anyone had the same problem?
L
EDIT:
Output is in "m/s", the deafult SI unit for speed so the readings are correct.