From Fdroid (free-software apps), install: Termux Termux:API Grant any necessary permissions to these. It's Termux:API that can use Location data. In termux, install the connection for the API $ apt install termux-api For background running, it may be necessary to allow Termux a permission for background activity. Nothing was visible for this in the Android settings initially, under power saving and battery, but on running (in Termux) $ termux-wake-lock the Android dialog came up for background permission. Now quite a number of termux-* commands are available to show/get things about the Android environment and sensors. Not all are actually useful on this particular phone, given its available hardware. termux-am termux-am-socket termux-api-start termux-api-stop termux-audio-info termux-backup termux-battery-status termux-brightness termux-call-log termux-camera-info termux-camera-photo termux-change-repo termux-clipboard-get termux-clipboard-set termux-contact-list termux-dialog termux-download termux-exec-ld-preload-lib termux-exec-system-linker-exec termux-fingerprint termux-fix-shebang termux-info termux-infrared-frequencies termux-infrared-transmit termux-job-scheduler termux-keystore termux-location termux-media-player termux-media-scan termux-microphone-record termux-nfc termux-notification termux-notification-channel termux-notification-list termux-notification-remove termux-open termux-open-url termux-reload-settings termux-reset termux-restore termux-saf-create termux-saf-dirs termux-saf-ls termux-saf-managedir termux-saf-mkdir termux-saf-read termux-saf-rm termux-saf-stat termux-saf-write termux-sensor termux-setup-package-manager termux-setup-storage termux-share termux-sms-inbox termux-sms-list termux-sms-send termux-speech-to-text termux-storage-get termux-telephony-call termux-telephony-cellinfo termux-telephony-deviceinfo termux-toast termux-torch termux-tts-engines termux-tts-speak termux-usb termux-vibrate termux-volume termux-wake-lock termux-wake-unlock termux-wallpaper termux-wifi-connectioninfo termux-wifi-enable termux-wifi-scaninfo They take a '-h' option for showing simple help. $ termux-battery-status { "health": "GOOD", "percentage": 85, "plugged": "PLUGGED_USB", "status": "NOT_CHARGING", "temperature": 24.899999618530273, "current": 0 } $ termux-location { "latitude": 59.xxxxxx, # digitsreplaced "longitude": 18.xxxxxx, # digitsreplaced "altitude": 37.3, "accuracy": 10.899999618530273, "vertical_accuracy": 224.89999389648438, "bearing": 261.3399963378906, "speed": 1.0531216859817505, "elapsedMs": 114, "provider": "gps" } $ termux-info Termux Variables: TERMUX_APK_RELEASE=F_DROID TERMUX_APP_PACKAGE_MANAGER=apt TERMUX_APP_PID=22163 TERMUX_IS_DEBUGGABLE_BUILD=0 TERMUX_MAIN_PACKAGE_FORMAT=debian TERMUX_VERSION=0.118.0 TERMUX__USER_ID=0 Packages CPU architecture: aarch64 Subscribed repositories: # sources.list deb https://nl.mirror.flokinet.net/termux/termux-main stable main # root-repo (sources.list.d/root.list) deb https://nl.mirror.flokinet.net/termux/termux-root root stable # x11-repo (sources.list.d/x11.list) deb https://nl.mirror.flokinet.net/termux/termux-x11 x11 main Updatable packages: gpgv/stable 2.5.5 aarch64 [upgradable from: 2.4.5-3] libassuan/stable 3.0.2 aarch64 [upgradable from: 3.0.1-2] libgpg-error/stable 1.55 aarch64 [upgradable from: 1.50] libheif/stable 1.19.8 aarch64 [upgradable from: 1.19.7] openssh-sftp-server/stable 10.0p2-5 aarch64 [upgradable from: 10.0p2-4] openssh/stable 10.0p2-5 aarch64 [upgradable from: 10.0p2-4] termux-tools version: 1.45.0 Android version: 14 Kernel build information: Linux localhost 4.19.191-27949366-abA145RXXS4BXA2 #1 SMP PREEMPT Thu Jan 18 10:59:56 KST 2024 aarch64 Android Device manufacturer: samsung Device model: SM-A145R Supported ABIs: SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi SUPPORTED_64_BIT_ABIS: arm64-v8a LD Variables: LD_LIBRARY_PATH= LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.so Installed termux plugins: com.termux.api versionCode:51 $ termux-sensor -l { "sensors": [ "mc34x9", "af6133e", "mn_sensor_l", "mn_sensor_p", "GRAVITY", "LINEARACCEL", "ROTATION_VECTOR", "GAME_ROTATION_VECTOR", "SIGNIFICANT_MOTION", "STEP_DETECTOR", "STEP_COUNTER", "GEOMAGNETIC_ROTATION_VECTOR", "TILT_DETECTOR", "Wake Up Motion", "Smart Alert Sensor", "SX9325 Grip Sensor", "SX9325 Grip Sensor for sub", "Screen Orientation Sensor", "Motion Sensor", "Orientation Sensor" ] } $ termux-sensor -n 1 -a { "GAME_ROTATION_VECTOR": { "values": [ 0.4132840037345886, -0.3242979943752289, -0.3980199992656708, 0.7520670294761658 ] }, "GEOMAGNETIC_ROTATION_VECTOR": { "values": [ -44.51823425292969, -73.81590270996094, -61.22407150268555, 0, 0 ] }, "LINEARACCEL": { "values": [ 0.0529169999063015, -0.30396801233291626, 0.0737759992480278 ] }, "GRAVITY": { "values": [ 1.5578089952468872, 8.630748748779297, 4.395398139953613 ] }, "SX9325 Grip Sensor": { "values": [ 5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, "SX9325 Grip Sensor for sub": { "values": [ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] }, "Screen Orientation Sensor": { "values": [ 0 ] }, "mn_sensor_l": { "values": [ 373 ] }, "mc34x9": { "values": [ 2.848950147628784, 7.396050453186035, 4.474950313568115 ] }, "ROTATION_VECTOR": { "values": [ 0.4132840037345886, -0.3242979943752289, -0.3980199992656708, 0.7520670294761658, 0 ] }, "Orientation Sensor": { "values": [ 52.18567657470703, -61.61689376831055, 10.231416702270508 ] }, "af6133e": { "values": [ -44.51250076293945, -73.81875610351562, -61.218753814697266 ] }, "mn_sensor_p": { "values": [ 5 ] } }