How to open the Huawei AppGallery directly?

后端 未结 6 925
青春惊慌失措
青春惊慌失措 2020-12-14 10:47

I know that is possible to open my app (based on package name) in Google Play Store, but how to do same in Huawei AppGallery?

相关标签:
6条回答
  • 2020-12-14 10:55

    As for how to link to an app detail page or an app list page on AppGallery:

    • The link that you referred: here is to an app detail page. Huawei does support the app detail page using badge service on AppGallery. In other words, you can replace the Google link with Huawei badge link. You can get the detail information of badge service at here

    • For app listing on AppGallery, Huawei has not opened the ability to all developers except some invited developers.

    Hope this help and let me know if any questions.

    0 讨论(0)
  • 2020-12-14 11:01

    I agree with @Pierre

    But I also think you can resolve activity with links

    https://appgallery8.huawei.com/#/app/C<HUAWEI_APP_ID>

    or

    https://appgallery.cloud.huawei.com/uowap/index.html#/detailApp/C<HUAWEI_APP_ID>?appId=C<HUAWEI_APP_ID>

    For example, https://appgallery.cloud.huawei.com/uowap/index.html#/detailApp/C101652909?appId=C101652909

    0 讨论(0)
  • 2020-12-14 11:10

    Ok bro. You can use the package name. com.huawei.appmarket and use Intent. There is a similar question here. Launch an application from another application on Android

    Good luck for whatever you doing

    0 讨论(0)
  • 2020-12-14 11:12

    A simple way to open app in Huawei App Gallery store:

    public void reviewApp(String packageName){
            try {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("appmarket://details?id=" + packageName));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
            } catch (ActivityNotFoundException anfe) {
                Toast.makeText(this, "Huawei AppGallery not found!", Toast.LENGTH_SHORT).show();
            }
    }
    

    then call it from your activity:

    reviewApp(this.getPackageName());
    

    or:

    reviewApp("com.myapp.android");
    
    0 讨论(0)
  • 2020-12-14 11:12

    You can use the badge service provided by HUAWEI AppGallery to promote your app, including preparing materials for making a badge, configuring an app link, and obtaining referrer statistics. With the service, you can efficiently collect statistics on app downloads in AppGallery and provide the silent installation service for users to improve the promotion effect.

    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.

    Check the screenshot below:

    0 讨论(0)
  • 2020-12-14 11:15

    Opening your app in the Huawei App Gallery is similar to opening Google Play Store:

    Huawei App Gallery uses its own scheme appmarket://:

    • Scheme: appmarket://
    • Package: com.huawei.appmarket

    vs. Google Play Store:

    • Scheme: market://
    • Package: com.android.vending

    Here is a snippet for the Huawei App Gallery:

    private void startHuaweiAppGallery() {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("appmarket://details?id=" + getPackageName()));
        List<ResolveInfo> otherApps = getPackageManager().queryIntentActivities(intent, 0);
    
        boolean agFound = false;
    
        for (ResolveInfo app : otherApps) {
            if (app.activityInfo.applicationInfo.packageName.equals("com.huawei.appmarket")) {
                ComponentName psComponent = new ComponentName(app.activityInfo.applicationInfo.packageName, app.activityInfo.name);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                intent.setComponent(psComponent);
                startActivity(intent);
    
                agFound = true;
                break;
            }
        }
    
        //Optional, Or copy the Google Play Store URL here (See below)
        if (!agFound) {
            //Your Huawei app ID can be found in the Huawei developer console
            final string HUAWEI_APP_ID = "100864605";
    
            //ex. https://appgallery.cloud.huawei.com/marketshare/app/C100864605
            intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://appgallery.cloud.huawei.com/marketshare/app/C" + HUAWEI_APP_ID));
            startActivity(intent);
        }
    }
    

    Here is the snippet for Google Play:

    private void startGooglePlay() {
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName()));
        List<ResolveInfo> otherApps = getPackageManager().queryIntentActivities(intent, 0);
    
        boolean psFound = false;
    
        for (ResolveInfo app : otherApps) {
            if (app.activityInfo.applicationInfo.packageName.equals("com.android.vending")) {
                ComponentName psComponent = new ComponentName(app.activityInfo.applicationInfo.packageName, app.activityInfo.name);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                intent.setComponent(psComponent);
                startActivity(intent);
    
                psFound = true;
                break;
            }
        }
        if (!psFound) {
            intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName()));
            startActivity(intent);
        }
    }
    
    0 讨论(0)
提交回复
热议问题