Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Android Permissions accept/reject events and callback problems

Discussion in 'Unity Hub' started by clueduppstephen, Sep 5, 2019.

  1. clueduppstephen

    clueduppstephen

    Joined:
    Aug 6, 2019
    Posts:
    12
    I have a scenario where I require two permissions to be granted for a workflow where a picture is taken and then saved to local storage.

    As of Android V6 this should be done at the time they are required, but my problem with Unity's permission requests are that they don't appear to have any way to attach a listener to monitor the user's selection, or a way to request multiple permissions in one go.

    I do not want to poll permission changes in Update, simply because the user may never grant them which could hang my workflow, and I don't like the idea of using application focus as a trigger, as there may be cases where this is triggered by other unknown processes.

    Anyone got a solution that is not a paid for plugin?
     
  2. sbethge

    sbethge

    Joined:
    Mar 20, 2019
    Posts:
    16
    Just set a boolean when you're requesting the permissions and check for the permissions on application focus only when it is set. It's ugly but should work