Android Question android.permission.WRITE_SETTINGS problem

dragonguy

Active Member
Licensed User
Longtime User
My app(target sdk = 25) had using android.permission.WRITE_SETTINGS permission. First time launch the app, it will prompt up ask user to enable the permission but after restart the device, it will ask again. Is it normal?

Every time reboot the device, is it need to enable permission again?

B4X:
Sub CanWrite As Boolean
    Dim p As Phone
    If p.SdkVersion < 23 Then Return True
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    Dim jo As JavaObject
    Return jo.InitializeStatic("android.provider.Settings.System").RunMethod("canWrite", Array(ctxt))
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

dragonguy

Active Member
Licensed User
Longtime User
Yes, i had used runtimepermissions lib, but android.permission.WRITE_SETTINGS need special way to grant the permission.
B4X:
WRITE_SETTINGS
added in API level 1
String WRITE_SETTINGS
Allows an application to read or write the system settings.
Note: If the app targets API level 23 or higher, the app user must explicitly grant this permission to the app through a permission management screen. The app requests the user's approval by sending an intent with action ACTION_MANAGE_WRITE_SETTINGS. The app can check whether it has this authorization by calling Settings.System.canWrite().
Protection level: signature
Constant Value: "android.permission.WRITE_SETTINGS"
from https://developer.android.com/reference/android/Manifest.permission.html#WRITE_SETTINGS
not only reboot device, when re-install the app, also need to re-grant the permission.
 
Upvote 0

dragonguy

Active Member
Licensed User
Longtime User
i need to investigate my app first, something wrong in my app and make this happen.
thanks guys for reply.
 
Upvote 0
Top