Android Question [SOLVED] Removing "Don't ask again" option from access dialogue box

Discussion in 'Android Questions' started by rleiman, Oct 14, 2018.

  1. rleiman

    rleiman Well-Known Member Licensed User

    Hi Everyone,

    I'm using this line to make sure the user has permission to get the devices location when the user first installs the app.

    Code:
    Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
    It calls a dialogue box asking for access to the devices location. If the user taps "Deny" and starts up the app again, the same dialogue box is shown but this time it gives the user the option "Don't ask again". How do I stop "Don't ask again" from showing up on the dialogue box? I ask because some of my users are tapping "Don't ask again" and calling me up and I have to tell them they need to go to the app manager to allow the permission.

    Thanks.
     
  2. DonManfred

    DonManfred Expert Licensed User

    you can´t. It is the decission of the user to use it (or not). This is how android works.

    If you are still not getting permission then you can inform the user about this and ask him to change the permission for your app in his device.
     
    Erel, BillMeyer and ilan like this.
  3. rleiman

    rleiman Well-Known Member Licensed User

    Hi Don,

    Is there a way for me to find out if the user ticked the "Don't ask me again" checkbox? If I can set up a handler for that, then I can remind the user to set permission on the GPS before running the app.

    Here's the code I'm using.

    Code:
    Public Sub StartUpTheGPS

        
    ' Make sure there is permission to use the GPS and start it up if it's enabled.
        '------------------------------------------------------------------------------
        Try
            
    If Starter.GPS1.GPSEnabled = False Then

                
    Msgbox("My message is here.")

                
    StartActivity(Starter.GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
            Else

                Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
            
    End If
            
        
    Catch
        
    End Try
    End Sub
    Code:
    Sub Activity_PermissionResult (permission As String, Result As Boolean)

        
    ' If there is permission to use the GPS then start it.
        '-----------------------------------------------------
        If permission = Starter.rp.PERMISSION_ACCESS_FINE_LOCATION Then
            
    If Result Then
                
    CallSub(Starter, "StartGPS")
            
    Else
                
    Msgbox("My message is here.")
            
    End If
        
    End If
    End Sub
     
  4. DonManfred

    DonManfred Expert Licensed User

    i don´t know
    You can check for the permission; if not getting a success then you do not have the permission. Decide by yourself to show anything to the user that he need to give this permission.
     
    Erel likes this.
  5. Semen Matusovskiy

    Semen Matusovskiy Well-Known Member Licensed User

    Android offers shouldShowRequestPermissionRationale function.
    Take a look discussions, for example, https://stackoverflow.com/questions...stpermissionrationale-not-working-as-expected and samples, for example, https://www.programcreek.com/java-a...t&method=shouldShowRequestPermissionRationale


    shouldShowRequestPermissionRationale
    added in version 24.1.0

    boolean shouldShowRequestPermissionRationale (Activity activity, String permission)

    Gets whether you should show UI with rationale for requesting a permission. You should do this only if you do not have the permission and the context in which the permission is requested does not clearly communicate to the user what would be the benefit from granting this permission.

    For example, if you write a camera app, requesting the camera permission would be expected by the user and no rationale for why it is requested is needed. If however, the app needs location for tagging photos then a non-tech savvy user may wonder how location is related to taking photos. In this case you may choose to show UI with rationale of requesting this permission.
     
    mangojack likes this.
  6. rleiman

    rleiman Well-Known Member Licensed User

    Thanks for the replies. I'll code around it then and make sure the user gets the appropriate messages.
     
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