How to remove Android permissions added by a 3rd party library?

MattHarringtonMattHarrington USMember, University
edited October 2015 in Xamarin University

I use a 3rd party library from Google called ExoPlayer which adds READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE to its AndroidManifest.xml:

When I add a reference to ExoPlayer, my project inherits these permissions. I don't want that. What's the best way forward?

  1. Edit the ExoPlayer source before creating a binding?
  2. Unzip the final APK and edit AndroidManifest.xml? This gets messy, because the APK is signed.
  3. Edit AndroidManifest.xml in my project's obj directory, and then modify the build process to use it?
  4. Something else?


  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    I might not completely understand why you want to do that.

    It seems ExoPlayer requires those permissions. If you remove them, the player probably won't work. If it does not work, why would you reference it?

  • MattHarringtonMattHarrington USMember, University
    edited October 2015

    ExoPlayer needs read permission to play media from storage, and write permission to record streams to storage. To just play a stream from the internet, and not record it, I don't think read and write permissions are needed. I only use ExoPlayer to play such a stream. Since these are so-called "dangerous" permissions, I thought I'd remove them.

    From ExoPlayer's manifest:

      <!-- For streaming media over the network. -->
      <uses-permission android:name="android.permission.INTERNET"/>
      <!-- For reading media from external storage. -->
      <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
      <!-- For writing media to external storage. -->
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    I'd guess it still wants to write to the external storage in order to buffer. But unfortunately I cannot answer your question. I suggest you ask it over in the Android Forums.

  • MattHarringtonMattHarrington USMember, University

    I edited the ExoPlayer Java source, and built a new Xamarin binding. It appears to work, and can play a stream without throwing a security exception. So, my guess is that it doesn't need to access external storage to buffer, but that's a good point I hadn't thought of.

Sign In or Register to comment.