Android Question Runtime Permission Enable Gps

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi to all! Is possibile to send a dialog with the request to enable the gps?
B4X:
StartActivity(GPS.LocationSettingsIntent)
This code launch the setting in which you can enable the gps, but some application like Tinder implemented the direct dialog

Screenshot_20180219-232953.png Screenshot_20180219-232948.png
 

BillMeyer

Well-Known Member
Licensed User
Longtime User
The answer is right here. The first snippet of code is exactly what you want - AND - it works - I've tried it.

It also has a reference to runtime permissions which you will need with the new SDK's etc.

Enjoy !!

upload_2018-2-20_6-31-48.png
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
The answer is right here. The first snippet of code is exactly what you want - AND - it works - I've tried it.

It also has a reference to runtime permissions which you will need with the new SDK's etc.

Enjoy !!
Hi! Thanks for the answer! I asked the question because i tried the snippet, and for me doesn't work as expected, but it opens the option page (no dialog). Maybe can be a problem of target sdk?
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
The Dialog you need to do yourself. Show an alert and after the user click on OK you call the Setting Dialog.
You can not change the setting from your app.
But how applications like Tinder achieve this? In the first screenshot i attacched, if you click on ok you don't go on setting, but you enable the gps without another next step
 
Upvote 0
Top