[BUG] gps settings intent

Cableguy

Expert
Licensed User
Longtime User
I am currently playing with gps code, and ever since i used the setting intent, whenever i try to enable gps from the power widget, i am redirected to the settings activity, wich didn't happen before.
 

Cableguy

Expert
Licensed User
Longtime User
My issue is not code related, but has started to happen after a code testing.
I followed some examples and set the intent to b triggered if the gps was not on.
On my tablet i have a "power strip widget" which has 5 functions: bluetooth toggle, wifi toggle, gps toggle,, sync toggle and luminosity toggle.
Before using my testing code, hitting the gps toggle would do just that, without redirecting me to the gps settings screen, which is what it has started to happen now.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm having trouble getting ACTION_LOCATION_SOURCE_SETTINGS to do anything

B4X:
Sub OpenSettings(Section As String)
    Dim DoAction As Intent
        DoAction.Initialize("android.settings." & Section, "")
    StartActivity(DoAction)
End Sub

I've tried it without "android.settings." and still gotten nothing.

B4X:
Sub GetSettings(Setting As String) As String
    Dim P As Phone
    Return P.GetSettings(Setting)
End Sub

GetSettings("ACTION_LOCATION_SOURCE_SETTINGS") returns empty
 
Last edited:

NJDude

Expert
Licensed User
Longtime User
It should be like this:
B4X:
Sub OpenSettings(Section As String)
 
    Dim DoAction As Intent
   
    DoAction.Initialize("", "")
    DoAction.SetComponent("com.android.settings/." & Section)
   
    StartActivity(DoAction)
 
End Sub
 
Top