Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Dtb49's avatar
Dtb49
Explorer
6 months ago

Re-request Android Permissions failing?

I am working on an application that requires the use of the microphone. However, if someone were to accidentally or purposely decline permissions, it seems it is no longer possible to request them again if "Save Preference" is checked (which it is by default). 

As a developer how am I supposed to gracefully handle this? If I call Request Android Permissions again, the OS Hands appear for a split second and the screen flickers black but, it immediately returns focus to the app without prompting the user for permissions again.

Any suggestions to help solve this problem or workaround it? Obviously I can just force them to quit the game but, the main issue is that it will never allow me to request the permissions again and forces the user to go into the app permissions via the OS settings. Maybe this is the only way but seems pretty crappy from a user and developer perspective.

6 Replies

Replies have been turned off for this discussion
  • You should be able to adapt this code.     I am throwing some random Unity + Meta code in github to share. Look in the SampleAndroidPermissions directory.

    Note that this is called AFTER the app starts, so they may have to restart the app. (you can do that in code and have the app restart itself).

    https://github.com/RiverExplorer/UnityWithMeta

    • Dtb49's avatar
      Dtb49
      Explorer

      I have no trouble requesting the android permissions the first time the app starts up or if the user doesn't "save their preference." However, it is enabled by default and causes problems if they deny. (I tried to record/screenshot what I am talking about but, it blocked from being able to be viewed in the recording/photo)

      In the OS screen where it gives an option to "save the user's preference" to a selected permission it will perpetually deny my request for permissions after someone has denied it.

      So far I just have it so that if they have denied and saved their preference that it gives instructions to the user to enable them via the OS Settings. I was just hoping for a more elegant solution than soft locking a user until they can navigate to deeply buried permissions menu in the OS.

      • MetaStoreHelp's avatar
        MetaStoreHelp
        Community Manager

        Hey there Dtb49!

         

        We came across your post and thought you might benefit from the Meta Developer Hub!

         

        On the Developer Hub, you can consult blog posts and even get in touch with tailored Developer support, to help you get your games up and running smoothly.

         

        Good luck in development, we can't wait to see what you come up with!

  • And yes, the user MUST press the OS permission pop-up. This is  true on all android devices.

     

  • Restarting yourself is something like this:  

    Oculus.Platform.Application.launchOtherApp(
         Message.Data.AppID, AppOptions).OnComplete(OnLaunchedOtherApp);

     

    You provide your own app id.

     

  • Also in that sample, is how to check if the user has permission. If not, then re-ask.

    It does not care if they previously said no or to never ask again. If they do not have permission, re-ask.

     

    You could also re-check at critical points. So if they accidentally (or otherwise) turned it off, you can re-ask.