FreakyAli
FreakyAli

Reputation: 16572

Implementing the Google In-App using Play core API in Native Android and Xamarin

Recently while browsing Hotstar Android app and I got a pop up in it that said I need to update the application to the latest. So, I clicked on this update button and I saw that Google's In-App update API has launched so I tried to look for some or the other documentation related to it and could not find anything, has anyone already implemented this? Can someone point me in the right direction?

I have already checked the following:

https://www.gizmochina.com/2018/11/08/google-introduces-in-app-updates-api-allowing-to-update-app-while-in-use/

https://developers.google.com/android/work/play/emm-api/update

https://www.quora.com/Is-there-an-API-for-the-Google-Play-Store

Upvotes: 0

Views: 1224

Answers (1)

Saurabh Thorat
Saurabh Thorat

Reputation: 20734

Check these docs to support in-app updates.

To check if an update is available for your app:

AppUpdateManager appUpdateManager = AppUpdateManagerFactory.create(context);
Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();
appUpdateInfoTask.addOnSuccessListener(appUpdateInfo -> {
    if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
          && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
              // Request the update.
    }
});

Upvotes: 2

Related Questions