'Play Core in app update giving UPDATE_NOT_AVAILABLE on production release

I have integrated the play core in-app update it's working fine in the testing track but when a release is published in the production track it's always giving the UPDATE_NOT_AVAILABLE flag. I think the problem might be because Timed Publishing/Publishing Overview is enabled. Is there any fix or any setting which I have to change from the play console itself? or do I have to implement something in my android end? here is the Implemented code-

AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
    Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
    appUpdateInfoTask.addOnCompleteListener(listener -> {
        if (listener.isSuccessful()) {
            Log.d(TAG, "Update Available " + (listener.getResult().updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE)); // returns false
            Log.d(TAG, "Update Allowed" + listener.getResult().isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)); // returns false
            Log.d(TAG, "Update Availibility" + listener.getResult().updateAvailability()); // returns 1 that is UPDATE_NOT_AVAILABLE

            if (listener.getResult().updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
                    && listener.getResult().isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
                try {
                    appUpdateManager.startUpdateFlowForResult(
                            listener.getResult(),
                            AppUpdateType.IMMEDIATE,
                            activity,
                            1001);
                } catch (IntentSender.SendIntentException e) {
                    Log.e(TAG, "showPopup: ", e);

                    dialog.show();
                }
            } else {
                Log.d(TAG, "no update: " + listener.getResult());

                dialog.show();
            }
        } else {
            Log.e(TAG, "no update: ", listener.getException());
        }
    });


Solution 1:[1]

I had a similar problem yesterday, and in my desperation put what should of been a comment about having a similar problem as an answer... @Natty showed me the error of my ways, and I felt bad, so made sure I'd come back with a better actual answer:

I discovered that the likely culprit is google play app signing. It looks like they changed things in August 2021 so as the default is to allow google to manage the app signing, which means your app is signed by a different key with each release, and thus your releases have different signatures, and it won't find the updates. The exceptions is internal app sharing.

Sadly, there appears to be no way to opt-out

You can't disable App Signing after being activated as you can read in the image below:

see this post

It get worse... because ya know google... your can't delete you app either, the only thing you can do is to

  1. unpublish the app.
  2. Then create a new version on the google play store. Change the applicationId to some slight variant so it counts as a different app.
  3. When adding you first release for the new app in any track, make sure to select the appropriate option for app signing above where you drop in the app bundle
  4. click use different key
  5. Either use a keystore generated from android studio or make a new one. From then on google will use that same keystore for signing all future releases of the app.

I even went back and double checked this was the case for me, by checking the older version of the app and the new version on internal testing tracks. Indeed, the new version using the same app signing keystore works for in-app updates, but the older version with google app signing did not.

Just bear in mind a whole new app has to go through the review process, which can take 1-3 days for new apps (seemed to be much quicker once the initial review is done)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1