android - 如果它安装在设备中,如何从链接启动我的应用程序

标签 android url intentfilter

<data
  android:ssp="com.faithmusicmissions.cloudapp"
  android:path="/store/apps/details"
  android:host="play.google.com"
  android:scheme="https" />

使用此代码,我尝试从 Play 商店链接打开我的应用程序,
https://play.google.com/store/apps/details?id=com.faithmusicmissions.cloudapp

此代码有效,但问题是当我单击其他包含“play.google.com”的应用程序链接时,它还会提供打开我的应用程序的选项

例如我的电子邮件中有 2 个 Play 商店应用程序链接,其中一个是我的应用程序链接,另一个是另一个应用程序链接
1. https://play.google.com/store/apps/details?id=com.faithmusicmissions.cloudapp
2. https://play.google.com/store/apps/details?id=com.tradiesfriend.tradie

当我点击两个链接时,它们会显示相同的选择器对话框来启动我的应用程序

如何为此 https://play.google.com/store/apps/details?id=com.faithmusicmissions.cloudapp 在元素中使用我的应用程序链接

最佳答案

    Manifest file 

     <activity
                android:name=".SplashScreenActivity"
                android:label="@string/app_name"
                android:screenOrientation="portrait" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" >
                    </category>
                </intent-filter>
                <intent-filter android:label="@string/app_name" >
                    <action android:name="android.intent.action.VIEW" >
                    </action>

                    <data
                        android:host="xxx.com"
                        android:scheme="http" >
                    </data>

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

if want to access url 
In activty

try {
    Uri intentUri = getIntent().getData();
    Log.d(TAG, "Request intentUri: "+intentUri);

} catch (Exception e) {
    Log.i(TAG, "Request intentUri: " , e);
} 

关于android - 如果它安装在设备中,如何从链接启动我的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25968300/

相关文章:

android - 如何在 Android 上实现我自己的 URI 方案

Android 的 intent-filter 匹配文件而不考虑其扩展名

Android:了解 Intent 过滤器

android - android中 View 的缩放和平移

Android-当我调用 onClick_Start 方法时,应用程序崩溃

android - 滑动刷新后删除项目不更新 RecyclerView

linux - 如何在unix盒子中打开网络浏览器?

android - 有没有办法通过我自己的短语进行语音激活?

python - 如何访问py文件中的media_root

php - 如何获取外部网站的基本 URL