How To Open The Huawei Appgallery Directly?
Solution 1:
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:
privatevoidstartHuaweiAppGallery() {
Intentintent=newIntent(Intent.ACTION_VIEW, Uri.parse("appmarket://details?id=" + getPackageName()));
List<ResolveInfo> otherApps = getPackageManager().queryIntentActivities(intent, 0);
booleanagFound=false;
for (ResolveInfo app : otherApps) {
if (app.activityInfo.applicationInfo.packageName.equals("com.huawei.appmarket")) {
ComponentNamepsComponent=newComponentName(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 consolefinalstringHUAWEI_APP_ID="100864605";
//ex. https://appgallery.cloud.huawei.com/marketshare/app/C100864605
intent = newIntent(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:
privatevoidstartGooglePlay() {
Intentintent=newIntent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName()));
List<ResolveInfo> otherApps = getPackageManager().queryIntentActivities(intent, 0);
booleanpsFound=false;
for (ResolveInfo app : otherApps) {
if (app.activityInfo.applicationInfo.packageName.equals("com.android.vending")) {
ComponentNamepsComponent=newComponentName(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 = newIntent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + getPackageName()));
startActivity(intent);
}
}
Edit
Huawei App Gallery now also supports the same Scheme as Google Play Store: market://com.huawei.appmarket
Solution 2:
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
Solution 3:
If your application has already released on the Huawei Appgallery, then you can use this url to open the application directly.
- URL with the appid of your applcation, for example the AppGallery's appid is 27162, then can open it with this URL
https://appgallery.huawei.com/#/app/C27162
You can replace the appid with your own appid .
- URL with the package name of your application, for example the AppGallery's package name is com.huawei.appmarket, then can open it with this URL
https://appgallery.cloud.huawei.com/appDetail?pkgName=com.huawei.appmarket
You can replace the package name with your own package name.
Wish it can be helpful.
Solution 4:
A simple way to open app in Huawei App Gallery store:
publicvoidreviewApp(String packageName){
try {
Intent intent = newIntent(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");
Solution 5:
It seems Huawei App Gallery can now open the details page with the same URI that works for Google Play: market://details?id=<applicationId>
I just tried it out on AppGallery v11.1.2.304 with an applicationId that exists on both stores:
adb shell am start -a "android.intent.action.VIEW" -d "market://details?id=busu.blackscreenbatterysaver"
Post a Comment for "How To Open The Huawei Appgallery Directly?"