如何在Android浏览器中点击网址启动应用

时间:2015-08-15 08:48:52

标签: android android-activity google-play

如果在设备上安装了应用程序,我必须从浏览器点击网址打开(启动)应用程序。

如果未安装应用程序,则应将其重定向到Google Play商店。

eg.url - https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild

我正在使用此代码

 <activity
        android:name="com.quantumsolutions.activities.Splashscreen"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <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:host="GiftFund.com"
                android:scheme="http" />
            <data
                android:host="giftfund.com/details?id=123"
                android:scheme="http" />
            <data
                android:host="giftfund.com/event?event_code=PF38A"
                android:scheme="http" />
            <data
                android:host="qa.GiftFund.com"
                android:scheme="http" />
            <data
                android:host="dev.GiftFund.com"
                android:scheme="http" />
            <data
                android:host="giftfund.com"
                android:scheme="http" />
            <data
                android:host="qa.giftfund.com"
                android:scheme="http" />
            <data
                android:host="dev.giftfund.com"
                android:scheme="http" />
        </intent-filter>
        <!--
             <intent-filter>
            <data android:scheme="giftfund" />

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        -->

    </activity>

用户可以通过邮件接收此网址,或在Facebook或短信上发帖,但目前如果我通过gmail获取网址而不是点击能够启动应用程序的网址,但是当我点击此网址时在浏览器或短信中

例如来自basecamp或facebook post在浏览中它没有显示我 我的应用程序弹出并重新指示我玩商店并显示安装应用程序但已经安装了应用程序。

1 个答案:

答案 0 :(得分:0)

如果您要启动已安装在用户设备上的应用,则可以使用自定义方案的方法 zkminusck answer https://stackoverflow.com/a/32026047/2717821

但如果未安装应用,则无法重定向到Google Play

相关问题