Huawei AppGallery: Linking to an app in the store listing

1.6k views Asked by At

is there a possibility to link to an application listing on AppGallery?

On google we would tipically do this:

http://play.google.com/store/apps/details?id=com.example.myapp

I found this page: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-createlinks-byagc, but this seems to be different from what I am asking.

2

There are 2 answers

5
zhangxaochen On BEST ANSWER

Update:

the user opens the app and an update is required, then we would like to show a popup with a button that would take the user directly to AppGallery, from where the newest version can be installed.

Joint operations services provides the capability of Updating an App. Your app can call the update API of the HMS Core SDK to check whether there is a later version available on AppGallery and display a pop-up asking the user whether to update the app.

Development Process:

  1. A user triggers an update check, for example, by launching the app or manually performing the check on the update check page.

  2. The app calls JosApps.getAppUpdateClient to request to initialize the AppUpdateClient instance.

AppUpdateClient client = JosApps.getAppUpdateClient(this);
  1. The HMS Core SDK returns the AppUpdateClient instance of the current app to the app.

  2. The app calls the AppUpdateClient.checkAppUpdate method to request an update check.

public void checkUpdate() {
    AppUpdateClient client = JosApps.getAppUpdateClient(this);
    client.checkAppUpdate(this, new UpdateCallBack(this));
}
  1. The HMS Core SDK queries the latest app version information on AppGallery.

  2. AppGallery sends the app version information back to the HMS Core SDK.

  3. The HMS Core SDK sends the check result to the app through a callback.

  4. The app checks the ApkUpgradeInfo instance returned by the onUpdateInfo method in the callback result and checks whether an update is available.

private static class UpdateCallBack implements CheckUpdateCallBack {
    private ManinActivity apiActivity;
    private UpdateCallBack(GameApiActivity apiActivity) {
        this.apiActivity = apiActivity;
    }
    public void onUpdateInfo(Intent intent) {
        if (intent != null) {
            // Obtain the update status code. Default_value indicates the default return code when status cannot be obtained, which is determined by the app.
            int status = intent.getIntExtra(UpdateKey.STATUS, DEFAULT_VALUE);
            // Error code. You are advised to record it.
            int rtnCode = intent.getIntExtra(UpdateKey.FAIL_CODE, DEFAULT_VALUE);
             // Failure information. You are advised to record it.
            String rtnMessage = intent.getStringExtra(UpdateKey.FAIL_REASON);
            Serializable info = intent.getSerializableExtra(UpdateKey.INFO);
            // Check whether the app has an update by checking whether info obtained is of the ApkUpgradeInfo type.
            if (info instanceof ApkUpgradeInfo) {
                // Call the showUpdateDialog API to display the update pop-up. The demo has an independent button for displaying the pop-up. Therefore, this API is not called here. For details, please refer to the checkUpdatePop() method.
                apiActivity.showLog("There is a new update");
                apiActivity.apkUpgradeInfo = (ApkUpgradeInfo) info;
            }
            apiActivity.showLog("onUpdateInfo status: " + status + ", rtnCode: " + rtnCode + ", rtnMessage: " + rtnMessage);
        }
    }
}
  1. The app calls the AppUpdateClient.showUpdateDialog method to request to display the update pop-up for the user.
public void checkUpdatePop(boolean forceUpdate) {
    AppUpdateClient client = JosApps.getAppUpdateClient(this);
    client.showUpdateDialog(this, apkUpgradeInfo, forceUpdate);
    Log.i(TAG, "checkUpdatePop success");
}
  1. The HMS Core SDK displays the update pop-up for the user.

  2. The user chooses to update the app on the update confirmation page.

  3. The HMS Core SDK sends a request to AppGallery to download the latest app installation package.

  4. AppGallery returns the app package to the HMS Core SDK. The HMS Core SDK starts to install the app after the download is complete.


You can use the badge service provided by HUAWEI AppGallery to collect statistics on app downloads in AppGallery and provide the silent installation service for users.

When a user taps your badge in a channel, the user is redirected to your app details page on AppGallery. The user can tap Install to automatically download and install your app.

Making a badge

  1. Sign in to AppGallery Connect and click In-app distribution.
  2. Click the Make badge tab.
  3. Click Add and add an app either by searching by keyword or app ID. (You can only make a badge for a released app.)
  4. Set Badge type, Display badge in, Channel name, and Referrer. The referrer is optional. If attribution statistics is required, you need to set the parameter.
  5. Click Generate badge to obtain the badge and its link.
0
Roy Solberg On

I suppose you don't mean to open in a browser, but through an intent that AppGallery reacts to.

You can use market://details?id=com.example.myapp which works for both AppGallery and Play Store.

From AppGallery's AndroidManifest.xml:

<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:scheme="market" android:host="details"/>
</intent-filter>