简体   繁体   中英

Where should I programmatically download new version of my Android App?

I'm working on an internal app for ~500 users, so I don't want to publish it in the Play Store.

I've built an auto-update mechanism where I check for updates by calling my server and initiate the download using DownloadManager and then a BroadcastReceiver .

The storage directory where I download the new version of the App is important to me as I don't want to ask my users for WRITE_EXTERNAL_STORAGE permission.

I've investigated getFilesDir() , getExternalFilesDir() and getExternalPublicDir() but I'm confused what are the pros and cons of each when compared to other, and will there be any blocker that I may face if I choose a particular destination? Any help regarding that will be very much appreciated.

It is better to use getFilesDir() and store the code in your app's private area which is not accessible by other apps, to avoid security risks. The other two options return a directory that is accessible by other apps. You do not need WRITE_EXTERNAL_STORAGE permission to write files in the directory returned by getFilesDir().

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM