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. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Feature Request A way to stop unity for adding unwanted permissions when building for android

Discussion in 'VR' started by jdscogin, Dec 26, 2022.

  1. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
    I am requesting a switch or something to tell unity when it makes the manifest, to not include the Record_Audio and Microphone permissions. When creating an Oculus Quest app, and uploading it to the Oculus App store, it lists those permissions as not needed and fails to accept it. Anytime a routine references a Microphone, or Recording, Unity automatically adds those permissions to the android manifest. I have done a lot of searching, and to remove those permissions is very hard. This would make it much easier to get a Unity app on the Oculus App store.
    Thanks
     
    honor0102 likes this.
  2. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    777
    How about removing the parts of your code referencing the microphone, or recording?
     
  3. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
    I guess that would work, but it is not my code that includes it. It is in the Oculus code. And removing that might work, but each time Oculus is updated, it would be back. That has to be a better way. How many people create games for Oculus Quest?
     
    Shane_Michael likes this.
  4. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
    Watch this video and you can see how hard it is to do.



    There really should be a better way!
     
  5. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
    Come on people that create Quest 2 Games. Back me up!
     
  6. jj-unity

    jj-unity

    Unity Technologies

    Joined:
    Jan 4, 2017
    Posts:
    69
    I'll look into this issue. Thanks for bringing it up! We already explicitly remove the BLUETOOTH permission in this case, but it looks like there are other permissions we need to look at as well.
     
    GameFinder likes this.
  7. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
    Thanks so much.
     
  8. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
    Any update?
     
  9. Niter88

    Niter88

    Joined:
    Jul 24, 2019
    Posts:
    112
    Did you know that you can use a custom AndroidManifest and other custom stuff?
     
  10. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
    No.
     
    Niter88 likes this.
  11. Niter88

    Niter88

    Joined:
    Jul 24, 2019
    Posts:
    112
  12. Tanya_Li

    Tanya_Li

    Unity Technologies

    Joined:
    Jun 29, 2020
    Posts:
    100
    We recently had a fix related in our OpenXR XR Plugin package: Meta/Oculus builds now don't include Bluetooth permissions in Android manifest by default when using Microphone class in script code. Fix will be included in our OpenXR SDK 1.7.0 release, which will be released very soon at the beginning of March.
     
    Niter88 likes this.
  13. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
    Will this also exclude the Microphone Permissions?
     
  14. luispuertolas

    luispuertolas

    Joined:
    Sep 26, 2017
    Posts:
    7
    Ok, so basically there "is no fix" but there is a hack. After building your program, download Apktool, decompress the APK, modify de manifest, and recompress to apk. After that, you will need to use zipalign to align the apk. Then finally, sign the apk with apksigner. zipalign and apksigner are on the unity editor instalation SDK\build-tools\30.0.3\

    I managed to publish my app yesterday with Oculus Integration 50 and Unity 2022.2.16f1.
     
  15. reddo

    reddo

    Joined:
    Jul 1, 2015
    Posts:
    37
  16. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    85
  17. honor0102

    honor0102

    Joined:
    Jan 30, 2019
    Posts:
    14
    long time after this question posted but still this problem may be annoying for someone!
    I had a similar problem ,one plugin was adding some unwanted permissions and found an easy way to remove them.
    A brief explaination:
    Enable the custom Android Manifest option in player settings
    Open the created android manifest file and add permissions you dont want with property of tools:node="remove" and it will override it! no decompile or any tricky method needed!
    like this:
    (add these tags before starting of application tag in manifest file)

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />


    i explained it on another topic too check it out if you need

    hope it helps
     
    eXntrc likes this.