2

We have an Android app (.apk) published to a publicly accessible URL, any user who knows the URL can download and install the app.

The app is already installed on the relevant user phones and allowing sideload option from the settings is turned on.

How can I force the app, on start, to check for update and replace the existing app if found, then restart the app (to pick up the latest version)?

Is there a standard solution or a software package? Should I be thinking in a different way?

I am using Xamarin Forms, however, I am happy with Xamarin Android or any Java-based solution.

Adam
  • 3,872
  • 6
  • 36
  • 66

2 Answers2

2

One thing you could do is to have a small plain text file in the same server where the APK is, that contains the version number of the APK available on the server. The runing app then just reads that text file and compares against its own version number.

If the version on the server is newer (has a higher version number), you simply download the new APK to a temp dir and install the APK programatically using the method outlined here: Android: install .apk programmatically

Community
  • 1
  • 1
AlxDroidDev
  • 582
  • 7
  • 17
1

The way to go is HockeyApp. It´s a distribution system that does exactly what you are looking for. Besides, you get a useful crash logger and some statistics, etc. It´s free for 2 apps.

Once you install and configure their SDK in your Android app, an activity will popup telling the user a new update is available if there is any. The user can install the new version with a button tap. Simple.

The setup process involves installing a nuget package and write a few lines of code in your main Activity class.

xleon
  • 6,201
  • 3
  • 36
  • 52
  • I am already using HockeyApp, but it feels that this method is for beta testers rather than production use. I will, however, consider this solution if nothing better pops up. – Adam Jan 18 '17 at 08:09
  • 1
    If the app is not in the store, what's the difference between beta and production? – xleon Jan 18 '17 at 08:13