Android replacement for requestLegacyExternalStorage? - android

I have an application published in Google play store, its name is PainterSVG, main purpose is to help SVG designers to create/edit SVG vector images.
It works well when user opens external SVG files, edit, and save back to external storage, using requestLegacyExternalStorage flag in AndroidManifest file.
But now Google is saying writing to external storage is only allowed for File Manager applications. And my app is not File Manager and will be delisted from play store, if I continue to use this flag.
What is the best solution for this case? I can share SVG files out from app with FileProvider, but users are complaining it is very inconvenient, as they have to share to something like email and receive the file in email.
Is there a better solution for this? Thanks a lot!

Related

How to copy internal directory audio files to external directory in Android 11

I have a music app which lets user purchase music, and used to store it in own folder in external storage(works perfect till android 10).
From android 11, initially I used getFilesDir(internal storage) and the version has been live on play store, now user isn't able to see the physical file in file manager, I am aware about how scoped storage work, if my files would have been in external directory, user would be able to see it in ASD(app specific directory) but now in internal storage that also isn't accessible.
All downloaded files are visible to me in emulator at path: /data/user/0/com.packagename/files/FolderName/Music/
But I need it to be accessible by user so that he can access it.
Also, Is there anyone founded a way to transfer(move,copy) our files to Shared Directory(Downloads/Music), I am aware it needs MANAGE_PERMISSION which wasn't allowed by Google.
Really appreciate any help.
I don't think now you have option to backup your data, most probably your users are going to sue you.
No magical solution for this. I think #blackapps is just bluffing.

Download PDF from a URL in Downloads folder on android app with targetSdkVersion=30

I want to download a pdf from a url on Android>=11. My app is targeting android version 30.
I read that due to restrictions introduced from Android 11, it does not easily allow us to store files in external Downloads folder and we have to store it inside Android/package_name/[folder]/[file], but I want to store it in Downloads folder so that my user does not have to go inside Android/package/[Downloads]/[file] to view that file.
Also on devices which are running Android<11, I can download that file by simply using getExternalStorageDirectory right? Please provide me some clarity on this.
I found some answers previously but they weren't that helpful. Can anybody tell me how to achieve this?
In Android 10ff it is not easy to use the java class "File" to store data in a public accessable folder that is pre-defined by your app.(ie the public download folder)
Instead your app has to ask the app-user where he/she wants to store the document.

Storage so my media/non media files are accessible by other apps

I am confused with the new app storage system in Android. I am not sure where my use case falls under and I need your help in telling me the right approach for this
My app captures images and generates pdf documents. Prior to Android 10, I used to store them in an app directory where the user can easily navigate to them through other files browsing app (like Files app on Samsung). In addition, these files can be accessed from within my app (so essentially read and write).
With the new storage, I am not sure how to accomplish the same thing. If I use the internal storage then user can't see them. If I use the media approach, well it seems it is only for Audio/video plus they will not be organized in a folder like I have them organized.
Am I missing something? How would I solve this problem?
Thank you
On an Android 11 device you can store your files in a subdirectory of the public Documents directory.
You can do that using classic File means or the media store or SAF.
Other apps can see them using SAF or the media store. Or with classic file means when requested all files access.
The user can see them using the default Files app on the device.

Is Downloader Library required for Android expansion files?

My app requires a lot of image resources, so I've had to package them into an expansion file. I've got this working fine when I manually copy the expansion file to my emulator's shared storage. What's unclear to me is the whole download process.
In Google's (often frustrating) documentation, it says:
On most devices, Google Play downloads the expansion file(s) at the same time it downloads the APK, so your application has everything it needs when the user opens it for the first time. In some cases, however, your application must download the files from Google Play when your application starts.
My app will be free with a single expansion file. Can I actually rely on the expansion file being downloaded with the app? Or must I implement the downloader service to ensure that the expansion file is downloaded when the app starts?
What are the circumstances under which the expansion file would not be downloaded with the apk? I suppose that the user might erase or remove the shared storage volume onto which the expansion file was originally copied, so that might be a case I'd have to worry about.
Tell me I can be lazy! Come on! And then someone link to this question on a blog post lamenting the laziness of app developers. OK, OK, I won't get all defensive. I just want to understand the mechanics here, and yes I would rather avoid the extra headaches of implementing the downloader service. I'm not a full-time Android developer, and I've got other things to do!
Thanks
The play store will attempt to download the expansion files but network connections fail or time out etc
You should check the files are available when your app starts and manually download them if they are not.
If you don't allow for this eventuality then some users will be unable to use your app unless it will work without the expansion pack.

Store content in android market

Can I upload content(any type png/jpg) onto android market, which I could download while the application is running.
No, you can only upload Application .apk files on to the Market.
If you don't have much content you can embed it in your application as a Resource. The content is then embedded into the .apk file and you can retrieve it using a standard Android API.
If you have lot of content - say, many megabytes - which you would rather download and perhaps cache on the SD card you'll need your own website.
You can also add it to /res/drawable and use it without the need of downloading.

Categories

Resources