Finder icon indicating copy to clipboard operation
Finder copied to clipboard

Turn on GPS, at least on rooted phone? (feature request)

Open OhSoGood opened this issue 6 years ago • 27 comments

Hi, I'd like to use your app (which is nice!), but I usually don't let the GPS activated on my device. Can't the app activate it, at least on rooted devices?

An app like Tasker, which can reproduce the same thing as your app, can activate the GPS. It would be great if your app were able to turn it on also (without Tasker of course).

Thank you!

OhSoGood avatar Jun 20 '19 07:06 OhSoGood

No, unfortunately android don't allow enable gps, only if device is rooted. Now such function not implemented (app was designed for "normal" devices :). But it may be useful feature, I'll think about adding it.. But it enables wifi for searching nets (and then returns it state to original)

Seva-coder avatar Jun 20 '19 21:06 Seva-coder

+1 to this! It would be very useful!

Mhowser avatar Jul 10 '19 03:07 Mhowser

Personally, I am using Tasker in the meantime. You can recreate almost the same thing, I just wasn't able (yet) to hide the incoming and outgoing sms with Tasker. But for sure 'Finder' would be nice with the option for rooted phone to enable GPS... +1 for the author in all cases!

OhSoGood avatar Jul 10 '19 08:07 OhSoGood

You don't need a rooted device to activate GPS. If you have ADB you can give any App the permission to activate GPS. Currently I develop a fork of this App. When I'm ready I can make a pull request.

domkrm avatar Nov 15 '19 18:11 domkrm

You don't need a rooted device to activate GPS. If you have ADB you can give any App the permission to activate GPS. Currently I develop a fork of this App. When I'm ready I can make a pull request.

I'm ready and made a pull request. I hope Seva will merge it :smiley:.

domkrm avatar Nov 16 '19 23:11 domkrm

so how did it end? it's ready to be implemented? would be incredible if it's preference for certain numbers only (not global option) and it we have instruction how to do it (simple adb commands) in readme.

alekksander avatar Dec 30 '19 13:12 alekksander

Would like to know as well.

Mhowser avatar Dec 30 '19 18:12 Mhowser

Unfortunally Seva has not yet merged my pull request.

If you want, you can install the attached APK. This is a build of my pull request. But you have to uninstall the APP from the F-Droid first (all settings will be lost), because my build is not signed.

An updated readme can you find here: https://github.com/Seva-coder/Finder/blob/4ef56c4c3dff9fbab5f03d514e99b0e892442985/README.md

Please let me know if it works for you.

finder.zip

domkrm avatar Jan 01 '20 11:01 domkrm

so how did it end? it's ready to be implemented? would be incredible if it's preference for certain numbers only (not global option) and it we have instruction how to do it (simple adb commands) in readme.

I have implemented it as a global option. Maybe if I have time I can implement it on number level.

domkrm avatar Jan 01 '20 11:01 domkrm

Hello! I had tested GPS auto activation, it really works! Thanks to @domkrm The only thing is that "google play protect" warn when installing app, may be because "write_secure_setting" in manifest I tagged version as a release (v1.9) and F-Droid should compile it at soon

Seva-coder avatar Jan 21 '20 21:01 Seva-coder

So there is no toggle for it? It works out of the box for all trusted number?

alekksander avatar Jan 30 '20 11:01 alekksander

You have a toogle to turn this feature on for all trusted numbers or turn it off for all trusted numbers (default is off). But there is no option to enable it only for some of the trusted numbers.

domkrm avatar Jan 30 '20 19:01 domkrm

I just upgraded to v1.9, changed the setting via adb and then in the app, sent a query from another phone... and the GPS did not activate. Any other thing to do?

OhSoGood avatar Jan 31 '20 09:01 OhSoGood

I just upgraded to v1.9, changed the setting via adb and then in the app, sent a query from another phone... and the GPS did not activate. Any other thing to do?

After the ADB command, have you enabled the option in the App settings?

domkrm avatar Jan 31 '20 10:01 domkrm

"and then in the app" He has

Atrate avatar Jan 31 '20 10:01 Atrate

"and then in the app" He has

You're right. I will try it later with the new version from F-Droid myself.

domkrm avatar Jan 31 '20 10:01 domkrm

I just upgraded to v1.9, changed the setting via adb and then in the app, sent a query from another phone... and the GPS did not activate. Any other thing to do?

I have tested a fresh install on LineageOS 16. I executed the ADB command and enabled the option in the App settings. Then I send a request to myself and GPS is activated automatically.

Which Android version do you have? Maybe you can take a look in the Logcat?

domkrm avatar Jan 31 '20 20:01 domkrm

on my MIUI (xiaomi) beside enabling ADB in phone settings, I also enabled "changing settings via ADB" permission in dev options (near ADB enabling). Is the command executed without errors?

Seva-coder avatar Jan 31 '20 21:01 Seva-coder

i confirm it works. unmodified, unrooted android 8.1. this is very nice to see, thank You both! it also disables gps after coordinates are send, so i wonder how „max gps run time" and „pause between scans” affect this?

alekksander avatar Feb 01 '20 14:02 alekksander

„max gps run time" - if phone can't get coordinates during this time (weak gps signal or it completely absent) app will stop trying get position to save battery. In this case SMS will contain error and battery charge. Also if accuracy less than seted, app will wait when accuracy become normal, but only during this time. In this case coordinates will be sent anyway (also with bad accuracy) „pause between scans” - this pause used to scan wifi nets

Seva-coder avatar Feb 01 '20 17:02 Seva-coder

I just retried with same result - GPS icon doesn't appear, and Finder never sends the sms answer with the position. Here is my logcat (started/stopped around the receipt of the sms query). At first sight, gps seems to start correctly but then I see exceptions at lines 2266 (note that I'm not expert neither in android dev nor in logcat...): logs.txt

My phone is a S7 running a slightly modified Samsung Pie rom (with Magisk and Microg notably).

OhSoGood avatar Feb 17 '20 16:02 OhSoGood

@OhSoGood but does Tasker works well (can enable gps) on this phone? lines below 2266 looks strange, like location is disabled. As I understand from log, your system use org.fitchfamily.android.dejavu location provider, may be it has some problems...

Seva-coder avatar Feb 18 '20 19:02 Seva-coder

Found a work around for this issue that might help fix it.

First followed the detailed steps to be able to enable GPS automatically:

  1. Connecting phone through ADB.
  2. Running adb shell pm grant ru.seva.finder android.permission.WRITE_SECURE_SETTINGS
  3. in Finder's settings, check "Turn Location on automatically".

This did not work. Realized that upon request, GPS signal turns on for a fraction of a second, than turns back off and returns a" GPS not enabled" text message.

Noticed that upon a WiFi request, WiFi is turned on automatically, as well as GPS. However GPS signal is not full - but on battery saving mode.

Workaround:

  1. In settings, toggle "Pause between scans" to about 60 (together with the default 3 WiFi scans, this will leave GPS open for 3 minutes).
  2. Send a WiFi request to phone.
  3. about 5-10 seconds after the WiFi request, send GPS request.

This should do the trick.

In essence, once the WiFi request enables battery saving GPS, the GPS request will fully enables GPS and return a location. Just make sure the WiFi scan will take long enough for the GPS to receive a fix.

Down side is that WiFi requests will take longer to return.

@Seva-coder I am not a programmer, but hopefully this will help identify the issue and create a solution.

forensicolten avatar Dec 05 '20 12:12 forensicolten

What android version are you using?

On Sat, Dec 5, 2020, 4:59 AM forensicolten [email protected] wrote:

Found a work around for this issue that might help fix it.

First followed the detailed steps to be able to enable GPS automatically:

  1. Connecting phone through ADB.
  2. Running adb shell pm grant ru.seva.finder android.permission.WRITE_SECURE_SETTINGS
  3. in Finder's settings, check "Turn Location on automatically".

This did not work. Realized that upon request, GPS signal turns on for a fraction of a second, than turns back off and returns a" GPS not enabled" text message.

Noticed that upon a WiFi request, WiFi is turned on automatically, as well as GPS. However GPS signal is not full - but on battery saving mode.

Workaround:

  1. In settings, toggle "Pause between scans" to about 60 (together with the default 3 WiFi scans, this will leave GPS open for 3 minutes).
  2. Send a WiFi request to phone.
  3. about 5-10 seconds after the WiFi request, send GPS request.

This should do the trick.

In essence, once the WiFi request enables battery saving GPS, the GPS request will fully enables GPS and return a location. Just make sure the WiFi scan will take long enough for the GPS to receive a fix.

Down side is that WiFi requests will take longer to return.

@Seva-coder https://github.com/Seva-coder I am not a programmer, but hopefully this will help identify the issue and create a solution.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Seva-coder/Finder/issues/7#issuecomment-739247944, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFYTD5BEWOP7I65FVUKXWJLSTIVELANCNFSM4HZQG6NA .

Mhowser avatar Dec 06 '20 10:12 Mhowser

Lineage 17.1 (Android 10).

Apologies for the late response.

What android version are you using?

forensicolten avatar Dec 14 '20 11:12 forensicolten

I also hit this issue, per forensicolten's comment I was able to wifi search and then gps search, and that worked.

Samsung S9+, stock android 10, via sprint / T-Mobile.

patman-cp avatar Apr 24 '21 17:04 patman-cp

Yup, not working as intented on LineageOS 17

"wifi search first" hack doesn't work for me when battery optimization is enabled :disappointed:

TheLastGimbus avatar May 15 '21 19:05 TheLastGimbus