Android : Force update apk when new version

Hi,

I search how to check when the game start if their is a new version on the play store, and display a message (or what you want canvas, toast, …) if a new version exist to force the player to update the game.

I found nothing on the forum, asset store and internet.
Can you help me ?

Very cordially.

I would just solve it, by hosting the version number on an external server. You just have to update it each time your new update is online.

I already though to this solution, but it is not an automaticaly way.
I prefere for exemple an plugin who parse play store (but depends on langage of the client, so it is complicated).

I don’t think you have an automatic solution for this.

Also, as far as I know, you cannot get the current live version from the google play store (there actually may be multiple different APKs at any given moment).

We have a solution for this using our backend servers - the game client can connect to our servers (but this can probably be just a static file holding the most up to date version), in case the client version is lower than the newest version it can be redirected to download the new version from the store.

2 Likes

You could use Unity Analytics Remote Settings for this very purpose https://docs.unity3d.com/Manual/UnityAnalyticsRemoteSettings.html . When a new version is ready, you update the value on the server. When your app starts, you check this value and you could either remind or force users to upgrade https://docs.unity3d.com/Manual/UnityAnalyticsRemoteSettings.html

Anyone has a CS version of the codes for in-app updates on Android that Google released officially?

The Remote Settings link has sample C# code, if that is what you are referring to. This may help too https://developers.google.com/android/work/play/emm-api/update

Can you guide me the latest way to force update the game? I want when player open the game it will check new version and show UI with update button to force the player to update the game if it’s old version. Press update button will auto direct to the google play store with the selected game. Seems like the the feature now is move to a package called Unity Remote Config.

Your first step would be to get the sample code working for Remote Config , have you done this?

1 Like

Ya. But I cannot understand why ConfigManager.FetchCompleted callback will call two times. First time with default value then following with the actual config from the remote config server. Is that a bug?

5308836--533577--upload_2019-12-23_16-4-29.png

Yes

1 Like

What is the ETA of getting this bug fix?

Can you show your FetchCompleted callback? Do you have a similar switch statement, checking the ConfigOrigin?

case ConfigOrigin.Default:
                MyDebug("No settings loaded this session; using default values.");
                break;
            case ConfigOrigin.Cached:
                MyDebug("No settings loaded this session; using cached values from a previous session.");
                break;
            case ConfigOrigin.Remote:
                assignmentId = ConfigManager.appConfig.assignmentID;
                MyDebug("assignmentId = " + assignmentId.ToString());
                break;

Ya. Anyway I already fix the bug by upgrading the package to latest version.

Hey please can you share the code i want to do that but don’t know how to do it

You would use Package Manager in the Unity Editor to upgrade the Remote Config package

Google play core in app updates are now available. You can use it to force the user to update the game.

1 Like