I made an application that will, on release, write and manage a database on the internal storage, because it doesn't really need to write to the sd card
However while debugging I would like to be able to write on the sd card so I can view and edit the database for testing purposes.
Is there a way to define in AndroidManifest that I want to have the read external and write external permissions only for the debug builds but not the release builds?
thanks in advance for any help you can provide
Edit: if anyone is reading this trying to find an answer , if you are using android studio, check the accepted answer
if you are using xamarin this seems to have worked for me, edit AssemblyInfo.cs and add:
#if DEBUG
[assembly: Application( Debuggable=true)]
[assembly: UsesPermission("android.permission.WRITE_EXTERNAL_STORAGE")]
[assembly: UsesPermission("android.permission.READ_EXTERNAL_STORAGE")]
#else
[assembly: Application(Debuggable=false)]
#endif
If you are using Android Studio, you can create a src/debug/AndroidManifest.xml
file and include your permission in it. The contents of that manifest will be merged in with your src/main/AndroidManifest.xml
file, plus manifests from any library, but only for debug
builds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With