Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application auto-update with self-hosting

Tags:

android

I'm planning to self-host my application but not sure what is the best way to implement auto-update.

I'm planning to do following:

  1. Application checks if newer version available on server
  2. If new version available - application will downloand APK to device's flash.
  3. ??

My question is how do I initialize update from code? I understand user will need to confirm this action but I want to do as much work as possible myself. Do I need to call specific intent to do this?

I guess question is how do I install APK programmaticaly if it's already on device..

like image 413
katit Avatar asked Jun 08 '26 04:06

katit


1 Answers

I guess question is how do I install APK programmaticaly if it's already on device..

You can launch the install using the following code:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
startActivity(intent);

The above code was taken from an answer to a similar question: automatic install of apk

like image 144
Michell Bak Avatar answered Jun 10 '26 19:06

Michell Bak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!