简体   繁体   English

如果未安装应用,请启动Google Play商店

[英]Launch google play store if app is not installed

Currently, I want to Open this link and if the application is not installed need it to navigate to google play. 目前,我想打开此链接,如果未安装该应用程序,则需要它导航到Google Play。 Following is the link I am trying to open. 以下是我尝试打开的链接。

intent:qoo10sg://moveTab?index=2&url=https%3A%2F%2Fm.qoo10.my%2Fgmkt.inc%2FMobile%2FDeal%2FTimeSale.aspx%3Fcix%3D0%26__da_seqno%3D39213891#Intent;package=net.giosis.shopping.sg;end; intent:qoo10sg:// moveTab?index = 2&url = https%3A%2F%2Fm.qoo10.my%2Fgmkt.inc%2FMobile%2FDeal%2FTimeSale.aspx%3Fcix%3D0%26__da_seqno%3D39213891#Intent; package = net。 giosis.shopping.sg; end;

I want it to launch to app store from this URL is it possible ? 我希望它可以从此URL启动到应用商店吗?

Use this 用这个

final String appPackageName = getPackageName(); // getPackageName() 
from Context or Activity object
try {
 startActivity(new Intent(Intent.ACTION_VIEW, 
 Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
 startActivity(new Intent(Intent.ACTION_VIEW, 
 Uri.parse("https://play.google.com/store/apps/details?id=" + 
 appPackageName)));
}
if (!openApp(MainActivity.this, "com.package")) {
    launchPlayStoreWithAppPackage(MainActivity.this, "com.pagkage");
}
/**
 * Open another app.
 *
 * @param context     current Context, like Activity, App, or Service
 * @param packageName the full package name of the app to open
 * @return true if likely successful, false if unsuccessful
 */
public static boolean openApp(Context context, String packageName) {
    PackageManager manager = context.getPackageManager();
    try {
        Intent i = manager.getLaunchIntentForPackage(packageName);
        if (i == null) {
            return false;
            //throw new ActivityNotFoundException();
        }
        i.addCategory(Intent.CATEGORY_LAUNCHER);
        context.startActivity(i);
        return true;
    } catch (ActivityNotFoundException e) {
        return false;
    }
}

/**
 * Open another app.
 *
 * @param context     current Context, like Activity, App, or Service
 * @param packageName the full package name of the app to open
 */
public static void launchPlayStoreWithAppPackage(Context context, String packageName) {
    Intent i = new Intent(android.content.Intent.ACTION_VIEW);
    i.setData(Uri.parse("https://play.google.com/store/apps/details?id=" + packageName));
    context.startActivity(i);
}

To accomplish this, you would need to perform a javascript redirect. 为此,您需要执行javascript重定向。 I would host a web page at any url you'd like ie yourdomain.com/checkForApp and have some simple redirects. 我会在您想要的任何URL上托管一个网页,即yourdomain.com/checkForApp并进行一些简单的重定向。

Try the link, if it fails use Javascript redirect to the play store or app store. 尝试链接,如果失败,请使用Javascript重定向到Play商店或应用商店。

setTimeout(function appNotInstalled() {
    window.location.replace("http://play.google.com/store");
}, 100);
window.location.replace("intent:qoo10sg://moveTab?index=2&url=https%3A%2F%2Fm.qoo10.my%2Fgmkt.inc%2FMobile%2FDeal%2FTimeSale.aspx%3Fcix%3D0%26__da_seqno%3D39213891#Intent;package=net.giosis.shopping.sg;end;");

Otherwise, Branch does this already within their SDK so you don't have to worry about building this out. 否则, Branch已经在其SDK中进行了此操作,因此您不必担心会这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从webview启动应用程序(如果未安装),重定向到Play商店 - Launch app from webview, if it is not installed, redirect to play store 如果已安装,请启动应用,或使用安装引荐来打开Goog​​le Play - Launch app if installed, or open Google Play with install referrer Google Play Store App 发布前发布报告 - Google Play Store App publich pre-launch report 启动Google Play Store for Developer - Launch Google Play Store for Developer 如何检测Google Play商店是否正在下载/安装特定应用? - How to detect if a specific app is being downloaded/installed by the Google Play store? 应用:从官方Google Play商店安装还是从磁盘安装? - App: installed from official Google Play Store or from disk? 从 Google Play 商店安装应用程序时崩溃 - App is crashing when installed from Google Play store PiracyChecker 无法检查应用程序是否从 Google Play 商店安装 - PiracyChecker fails to check whether the app is installed from Google Play Store 通过任何特定链接启动我的应用程序。 如果我的应用未安装,则在 Play 商店中重定向我 - Launch my application via any specific link. If my app is not installed than redirect me on Play Store 在已安装的应用上回调Google Play - callback google play on installed app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM