0

How can I update my application from my own server by pressing a button? I found this code but it gives an error with the uri

Intent promptInstall = new Intent(Intent.ACTION_VIEW) 
     .setDataAndType(
          Uri.parse("content:///path/to/your.apk"), "application/vnd.android.package-archive"
     );
startActivity(promptInstall); 
President James K. Polk
  • 40,516
  • 21
  • 95
  • 125

1 Answers1

1

Google has release an in app update feature for this, which checks playstore for any app update and in one click you can update your app.

Check out the documentation here:

https://blog.mindorks.com/implementing-in-app-updates-on-android

Otherwise if you want to manually allow user to download apk then you need to go the naive way like ask user to download app then install via Package Manager

Checkout this:

How to install/update/remove APK using "PackageInstaller" class in Android L?

Dhruv Kaushal
  • 632
  • 8
  • 17