0

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.

Andy Res
  • 15,182
  • 3
  • 55
  • 89

2 Answers2

1

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.
shirley
  • 6,207
  • 1
  • 14
  • 32
  • Thank you again for the fast answer @shirley. I guess I did not express myself very clear, just to give you a bit more context: we are implementing a force-update mechanism in the app, so imagine 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. So in this case we would not like to display a badge. What I found meanwhile is this: https://appgallery.huawei.com/#/app/C, that seems to work. What do you think? – Andy Res Dec 02 '20 at 10:31
  • @AndyRes Yes, I think what you need is [checkAppUpdate](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/appgallerykit-app-update) service. – shirley Dec 02 '20 at 10:59
  • This is not working, status is always 3. And I am getting weird error in logs --> W/UpdateSDKCheckTask: UpdateSDK get update info is not recommend,reason: Uninstall the old version before installing,is same signature: 1 – baribar Apr 08 '21 at 02:35
1

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>
Roy Solberg
  • 14,329
  • 9
  • 39
  • 68