I am working on a library to allow apps to self-update, for those that are being distributed outside of the Android Market.
My original plan was to include code that would download the APK file to internal storage, and then install it from there via a ContentProvider
and a content://
Uri
. However, when I tried that, the installer system dumped a "Skipping dir: " warning to LogCat and failed to actually install it. Once I switched to downloading the APK to external storage and using a file://
Uri
with the ACTION_VIEW
installer Intent
, it worked.
The "Skipping dir:" message seems to be logged by parsePackage()
in PackageParser
, which seems to assume that it is working with a File
. That would suggest that we cannot use content://
Uri
values.
Has anyone successfully used ACTION_VIEW
on a application/vnd.android.package-archive
Intent
with a content://
Uri
? If so, was there some specific trick in setting up the ContentProvider
that made it work?
Thanks!
A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily intended to be used by other applications, which access the provider using a provider client object.
You don't need ROOT permissions to get the list of Installed Apps. You can do it with android PackageManager.
There is no manual way on how to create an apk from an installed app on your Android smartphone. Hence you need to use a third-party application available on Google Play Store known as App Country Finder.
Just open your browser, find the APK file you want to download, and tap it – you should then be able to see it downloading on the top bar of your device. Once it's downloaded, open Downloads, tap on the APK file and tap Yes when prompted. The app will begin installing on your device.
The documentation for ACTION_INSTALL_PACKAGE is incorrect. It too will only accept files.
My only suggestion would therefore be to create a copy of the file in the applications file area, make it world readable, and clean up any left-over files at a later date.
Previous incorrect answer: In 4.0 and above there is a ACTION_INSTALL_PACKAGE which will accept a content:// URI (JavaDoc), but, prior to that, you're limited to installing via ACTION_VIEW which does assume the URI passed is a file:// URI.
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