- install termux app
- install termux-api app
- open termux terminal and install:
pkg install termux-api
On the first attempt you are going to get a permission error, and that will trigger a GUI dialog where you can allow termux-api to access the GPS subsystem.
Alternativelly you can setup this permission beforehand.
~ $ termux-location
{
"error": "Please grant the following permission to use this command: android.permission.ACCESS_FINE_LOCATION"
}~ $ termux-location
{
"latitude": 48.90542000000001,
"longitude": 18.187695,
"altitude": 352.0,
"accuracy": 5.5,
"vertical_accuracy": 57.29999923706055,
"bearing": 289.95001220703125,
"speed": 0.33714306354522705,
"elapsedMs": 12884902019,
"provider": "gps"
}~ $ echo "Poliklinika TN"
Poliklinika TN
~ $
~ $ termux-location
{
"latitude": 48.88806833333333,
"longitude": 18.031871666666667,
"altitude": 252.20000000000002,
"accuracy": 6.199999809265137,
"vertical_accuracy": 21.899999618530273,
"bearing": 358.1000061035156,
"speed": 0.6397997140884399,
"elapsedMs": 12884902040,
"provider": "gps"
}