How can I implement auto-updating of my application when a new version is released without using Google Play Store? I\'m using JSON to check the version.
My way of implementation is to use a variable and compare that variable from a database. It could be Firebase or any other. For this example, I will use Firebase realtime database.
int version = 1;
void checkLatestVersion(){
//Here i am getting just the value of the latest version stored on firebase.
databaseReference.child("version").child("latestRealase").once().then((snapshot){
if(snapshot.value != null){
int versionNumberFromDatabase = int.parse(snapshot.value));
if(versionNumberFromDatabase>version){
print("the app needs to be updated");
//HERE you can create a dialog to display and force users to update
}else{
print("The app doesn't to be need updated ");
}
}
});
}
The above example will work for both Android and iOS, but there is a package that will let you update your app from the app itself. Check the documentation.
in_app_update 1.1.7
This will enables In-App Updates on Android using the official Android APIs.