Android Question android.permission.WRITE_SETTINGS problem

Discussion in 'Android Questions' started by dragonguy, Aug 15, 2017.

  1. dragonguy

    dragonguy Active Member Licensed 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?

    Code:
    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
     
  2. eps

    eps Well-Known Member Licensed User

    What's in your manifest and what are you trying to achieve?
     
  3. DonManfred

    DonManfred Expert Licensed User

  4. dragonguy

    dragonguy Active Member Licensed User

    Yes, i had used runtimepermissions lib, but android.permission.WRITE_SETTINGS need special way to grant the permission.
    Code:
    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.
     
  5. DonManfred

    DonManfred Expert Licensed User

    I don´t see the permissionrequest in your code.
    How do you request the permission?
     
  6. dragonguy

    dragonguy Active Member Licensed User

    i need to investigate my app first, something wrong in my app and make this happen.
    thanks guys for reply.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice