[英]How to start my Android application when a link clicked from external app like whatsapp or facebook?
I have used deep linking concept using following intent filter in manifest file. 我在清单文件中使用以下意图过滤器使用了深层链接概念。
<activity
android:name=".MyActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden" >
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="test.myapp.com"
android:scheme="http"
/>
</intent-filter>
</activity>
This helps me to show my application when clicked on link in whats app, but it shows other applications in list like chrome,Internet etc. How can I make only to access my app directly after clicking link in other application like whats app.? 这可以帮助我在单击whats应用程序中的链接时显示我的应用程序,但可以在列表中显示诸如chrome,Internet等列表中的其他应用程序。如何在单击其他应用程序(例如whats app)中的链接后仅直接访问我的应用程序?
My only idea is to add an intent filter, that starts your app if the device opens a special URL (for example www.your-project.com). 我唯一的想法是添加一个意图过滤器,如果设备打开一个特殊的URL(例如www.your-project.com),它将启动您的应用程序。 Have a look on this documentation it explains all social sites linkage to your app. 请参阅此文档,它说明了所有社交网站与您的应用程序的链接。
If the user has your app installed, a click on the link will open your app. 如果用户安装了您的应用程序,则单击链接将打开您的应用程序。 Otherwise the link will be opened by your default browser. 否则,链接将由您的默认浏览器打开。
What you want to achieve is only possible from Android 6.0 , in Android 6.0 you can bypass the Intent chooser dialog and directly launch your application on clicking on the link. 您想要实现的目标只能在Android 6.0上实现,在Android 6.0中,您可以绕过Intent选择器对话框,然后单击链接直接启动您的应用程序。
To do this, please check on this App link documentation. 为此,请查看此应用程序链接文档。 They have explained very well how to do it 他们已经很好地解释了如何做
and also you may have to make slight modifications in the intent filter as shown below by adding parameter android:autoVerify="true"
并且您可能还必须通过添加参数android:autoVerify="true"
在意图过滤器中进行如下所示的轻微修改
<activity ...>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="www.example.com" />
<data android:scheme="https" />
</intent-filter>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.