Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do you request USB permissions for Android?

Discussion in 'Scripting' started by ghostravenstorm, Sep 28, 2021.

  1. ghostravenstorm

    ghostravenstorm

    Joined:
    Oct 18, 2015
    Posts:
    88
    I have a Unity Android prototype app I'm developing that uses a USB accessory.
    How do you request permissions for USB device access? I know how it's done in a vanilla Android app, but how do you make a request from the Unity side?

    https://docs.unity3d.com/ScriptReference/Android.Permission.html

    USB Host seems to be missing from the documentation.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    You might need to add an AndroidManifest.xml with the necessary permission to the correct spot in your project.
     
  3. ghostravenstorm

    ghostravenstorm

    Joined:
    Oct 18, 2015
    Posts:
    88
    Ok. I wasn't thinking about the AndroidManifest when it comes to Android deployment directly from Unity. I'll have to look into that.
     
    Kurt-Dekker likes this.