Android Question Turn on GPS

This will only work if the settings widget was added. If this is relevant for you then I can help you write this code.

You mean the notification drawer widget that comes with Samsung devices ?
sgsiiibirghtness.jpg



if you could write a library that could enable GPS on devices that uses this widget without user interaction that will be great ...
 
Upvote 0
This is the relevant code:
Code:
Sub TurnGPSOn
   Dim i As Intent
   i.Initialize("", "3")
   i.SetComponent("com.android.settings/.widget.SettingsAppWidgetProvider")
   i.AddCategory("android.intent.category.ALTERNATIVE")
   Dim p As Phone
   p.SendBroadcastIntent(i)
End Sub
It doesn't work on Android 4.4. You will see a message in the unfiltered logs about a permission problem.
 
Upvote 0
This has always been a problem.
If the user chooses NOT to turn on GPS, or I cannot force it on, then the data I collect is invalid - since US government rules demand lat/lon values with each record created.

Enabling GPS makes it available for all apps (I assume) - even the ones your kids don't want enabled for tracking them.
I think, as developers, we need an APP ONLY permission - where we need access to GPS. All other apps would have to ask, demand, register the same permission. Google would have to figure that one out...

The only alternative now, if GPS isn't enabled, is to close the app, or keep demanding that GPS be enabled... Both options stall data collection.
 
Upvote 0
This is the relevant code:
Code:
Sub TurnGPSOn
   Dim i As Intent
   i.Initialize("", "3")
   i.SetComponent("com.android.settings/.widget.SettingsAppWidgetProvider")
   i.AddCategory("android.intent.category.ALTERNATIVE")
   Dim p As Phone
   p.SendBroadcastIntent(i)
End Sub
It doesn't work on Android 4.4. You will see a message in the unfiltered logs about a permission problem.

i tried this on samsung grand and s3 both less than 4.4 without any success
 
Upvote 0
Back
Top