Hi!
I am facing an issue that I believe many xamarin android developers may also be facing. My app, up to android version 10 worked correctly. Basically I need to create at runtime (and update too), a SQLite .db file and two json files. Within the app, the user has the possibility to take a photo and save it or select a photo and save it too. All these files I'm saving in the app folder, fetching the url like this:
Path.Combine(FileSystem.AppDataDirectory, "filename").
Now with android 11 scoped storage I am getting the error "App Rejected on Playstore - Issue: Need to use Media Store API or No Access to Files". I've done a lot of research, read several articles, tried to find something in xamarin android c# about the same problem, but nothing makes the app to be accepted in the playstore. In my understanding, the app folder does not ask for permissions to write files. As a test, I migrated my app from xam.plugin.media plugin to xamarin.essentials.mediapicker. Removed all access permissions to internal and external storage from android.manifest (READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE and MANAGE_EXTERNAL_STORAGE) and it still didn't work. The creation of files, I'm doing as follows:
I noticed that xamarin.essentials.mediapicker asks for permission to access internal storage for capturing photos and selecting saved images. Friends, I ask for your help, as I am already confused where I should attack and how to solve this problem. I don't know if the problem is related to the selection or image capture or if it is in the recording of .db and json files. I tried to implement in my code, to take, for example, the sqlite .db file, without creating it at runtime, but I wasn't successful either, because I can't access it in the assets or ressources folder to open the connection. The biggest problem is understanding exactly what google is complaining about and how to use the Media Store API that it orders to be used with xamarin android. Any help will be welcome.
NOTE: I cannot use xamarin.essentials.mediapicker? I can't save files in the app folder (files) ? How to solve?
@Alessandro Caliaro @James Montemagno any idea friends?
Thanks!