termux-api icon indicating copy to clipboard operation
termux-api copied to clipboard

Termux-location not working via bash

Open pjkennedy opened this issue 7 years ago • 7 comments

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?

pjkennedy avatar Oct 21 '18 07:10 pjkennedy

I'm sometimes getting nothing when I execute termux-location -p network on interactive shell. Command execution takes long time, more than 1 minute.

ghost avatar Oct 21 '18 08:10 ghost

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.

pjkennedy avatar Oct 21 '18 08:10 pjkennedy

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.

pjkennedy avatar Oct 21 '18 15:10 pjkennedy

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

cslev avatar Sep 07 '21 03:09 cslev

Just realized I had an older verison. Still, after upgrading to the latest one from f-droid, i am still having the same issue :|

cslev avatar Sep 07 '21 04:09 cslev

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

cslev avatar Sep 08 '21 03:09 cslev

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.

rapbando avatar Nov 17 '22 12:11 rapbando