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?
Opening your app in the Huawei App Gallery is similar to opening Google Play Store:
Huawei App Gallery:
Scheme: market:// or 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() {
Uri detailsUri = Uri.parse("market://details?id=" + getPackageName());
Intent intent = new Intent(Intent.ACTION_VIEW, detailsUri);
List<ResolveInfo> otherApps =
getPackageManager().queryIntentActivities(intent, 0);
for (ResolveInfo app : otherApps) {
String packageName = app.activityInfo.applicationInfo.packageName;
if (!packageName.equals("com.huawei.appmarket")) {
continue;
}
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED |
Intent.FLAG_ACTIVITY_CLEAR_TOP
);
intent.setComponent(new ComponentName(packageName, app.activityInfo.name));
startActivity(intent);
return;
}
//Huawei App Gallery N/A. Open app link in browser.
//Huawei App ID can be found in the Huawei developer console
final string huaweiAppID = "100864605";
//ex. https://appgallery.cloud.huawei.com/marketshare/app/C100864605
Uri appUri = Uri.parse(
"https://appgallery.cloud.huawei.com/marketshare/app/C" + huaweiAppID
);
intent = new Intent(Intent.ACTION_VIEW, appUri);
startActivity(intent);
}
Here is the snippet for Google Play:
private void startGooglePlay() {
Uri detailsUri = Uri.parse("market://details?id=" + getPackageName());
Intent intent = new Intent(Intent.ACTION_VIEW, detailsUri);
List<ResolveInfo> otherApps =
getPackageManager().queryIntentActivities(intent, 0);
for (ResolveInfo app : otherApps) {
String packageName = app.activityInfo.applicationInfo.packageName;
if (!packageName.equals("com.android.vending")) {
continue;
}
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED |
Intent.FLAG_ACTIVITY_CLEAR_TOP
);
intent.setComponent(new ComponentName(packageName, app.activityInfo.name));
startActivity(intent);
return;
}
//Google Play N/A. Open app link in browser.
Uri appUri = Uri.parse(
"https://play.google.com/store/apps/details?id=" + getPackageName()
);
intent = new Intent(Intent.ACTION_VIEW, appUri);
startActivity(intent);
}
Here is the snippet to allow the user to pick Any Available Store on the device:
private void startAnyStore() {
Uri detailsUri = Uri.parse("market://details?id=" + getPackageName());
Intent intent = new Intent(Intent.ACTION_VIEW, detailsUri);
intent.addFlags(
Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED |
Intent.FLAG_ACTIVITY_CLEAR_TOP
);
startActivity(intent);
}
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
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.
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"
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");
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
Sign in to AppGallery Connect and click In-app distribution.
Click the Make badge tab.
Click Add and add an app either by searching by keyword or app ID. (You can only make a badge for a released app.)
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.
Click Generate badge to obtain the badge and its link.
Check the screenshot below:
Launch Play Store/AppGallery via package name.
private boolean openInStore(String uri){
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(Intent.createChooser(intent,getString(R.string.open_with)));
return true;
} catch (ActivityNotFoundException anfe) {
return false;
}
}
private void startOpenInStore() {
String playStoreScheme = "market://details?id=", huaweiScheme = "appmarket://details?id=";
if (!openInStore(playStoreScheme+getPackageName())) {
if (!openInStore(huaweiScheme + getPackageName())) {
openInStore("https://play.google.com/store/apps/details?id=" + getPackageName());
}
}
}
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.
Here is how to start App Gallery directly:
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri.Builder uriBuilder = Uri.parse("https://appgallery.cloud.huawei.com/ag").buildUpon();
intent.setData(uriBuilder.build());
intent.setPackage("com.huawei.appmarket");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
I think the shortest and easiest one would be running this simple link: https://appgallery.cloud.huawei.com/ag/n/app/<YOUR_APP_ID>.
No need to config anything and the rest will handled by Huawei automatically.
How to get YOUR_APP_ID?
Go to Huawei App Gallery
Search for your app (e.g. WeChat)
Copy the ID in the end of the link (e.g. https://appgallery.huawei.com/#/app/C5683)
In this case the APP_ID for WeChat would be C5683
So the Huawei app link for WeChat would be https://appgallery.cloud.huawei.com/ag/n/app/C5683
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 😊
Below is the code I used for sending messages to WhatsApp number through the android app
PackageManager packageManager = this.getPackageManager();
Intent i = new Intent(Intent.ACTION_VIEW);
try {
String phone="+919999999999";
String url = "https://api.whatsapp.com/send?phone="+ phone +"&text=" + URLEncoder.encode("hello", "UTF-8");
i.setPackage("com.whatsapp");
i.setData(Uri.parse(url));
if (i.resolveActivity(packageManager) != null) {
this.startActivity(i);
}
}
catch (Exception e){
Toast.makeText(HomeActivity.this,e.getMessage(),Toast.LENGTH_LONG).show();
}
it is working fine in debug version of the app, but not working in the release version. nothing happens after pressing send button, neither it shows an exception.
Hi i am creating a simple game and i want yo know how to launch Play Store in ligbdx when someone would like to rate my game.
Please help!
Thanks
You have two options :
Either open directly by using complete URL (generic for all platform)
Gdx.net.openURI("https://play.google.com/store/apps/details?id=com.xyz.abc");
Use interfacing and implement platform specific APIs.
eg. like for Android
public void rate(){
Intent rateIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id=com.xyz.abc"));
//or
//Intent rateIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id="+getPackageName()));
startActivity(rateIntent);
}
It prompt a choose dialog, having browser and Playstore app (If PlayStore installed in device) option. choose PlayStore.
EDIT
try {
Intent viewIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id=" + getPackageName()));
startActivity(viewIntent);
}catch (android.content.ActivityNotFoundException anfe){
String url="https://play.google.com/store/apps/details?id="+getPackageName();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (intent.resolveActivity(getPackageManager())!=null) {
startActivity(intent);
}
}
I want to create small application which when I start this small application in main activity I want to check if other application for example "barcode" is installed on my phone.
If yes I want to start application "barcode"
If no I want to install this application from google play.
How I can do that?
Check with following code if the application is installed
PackageManager pm = getPackageManager();
boolean app_installed = false;
try
{
pm.getPackageInfo("com.package.Barcode", PackageManager.GET_ACTIVITIES);
app_installed = true;
}
catch (PackageManager.NameNotFoundException e)
{
app_installed = false;
}
return app_installed ;
And following code redirects the user to the play store for downloading the application
String appName = "com.package.Barcode";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+appName));
startActivity(intent);
How to open an existing app you can find here:
Open another application from your own (intent)
And how to check if app exists you can find here:
How can I learn whether a particular package exists on my Android device?
Developing an application, In which I have many user's account_id(skype id), Now what I want is to open chat screen of Skype (already installed in device) when I click particular User's skype_id from my application.
I did search on web but got no success
Got the link how to start call on Skype but for chat?
1) Link 1
2) Link 2
You can use the Skype URI Scheme for this (Skype:echo123?chat).
You can find out more information about the URI Scheme here : https://dev.skype.com/skype-uri
Thanks
Allen Smith
Skype Developer Support Manager
Here is the code to open Skype chat conversation:
private void openSkype(Context context) {
// Make sure the Skype for Android client is installed
if (!isSkypeClientInstalled(context)) {
goToMarket(context);
return;
}
final String mySkypeUri = "skype:echo123?chat";
// Create the Intent from our Skype URI.
Uri skypeUri = Uri.parse(mySkypeUri);
Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri);
// Restrict the Intent to being handled by the Skype for Android client only.
myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
context.startActivity(myIntent);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Determine whether the Skype for Android client is installed on this device.
*/
public boolean isSkypeClientInstalled(Context myContext) {
PackageManager myPackageMgr = myContext.getPackageManager();
try {
myPackageMgr.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES);
} catch (PackageManager.NameNotFoundException e) {
return (false);
}
return (true);
}
/**
* Install the Skype client through the market: URI scheme.
*/
public void goToMarket(Context myContext) {
Uri marketUri = Uri.parse("market://details?id=com.skype.raider");
Intent myIntent = new Intent(Intent.ACTION_VIEW, marketUri);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
myContext.startActivity(myIntent);
}