简体   繁体   English

当从外部应用程序(如whatsapp或facebook)单击链接时,如何启动我的Android应用程序?

[英]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.

相关问题 单击应用程序链接时如何打开我的应用程序? - How to open my application when app link is clicked? Android:如何从我的应用程序使用whatsapp,facebook,gmail等发送应用程序邀请消息 - Android : How to send app invite message using whatsapp,facebook,gmail,etc from my app 如何从我的Android应用程序使用whatsapp? - How to use whatsapp from my Android app? 当应用程序在后台聊天时如何以通知格式(如WhatsApp)显示消息 - How to display messages in notification format like WhatsApp, when app is in background for chatting application on Android 当应用程序未运行时处理 android 推送通知,如 whatsapp、twitter、facebook、instagram 等 - Handle android push notification when app is not running like whatsapp, twitter, facebook, instagram etc 如何自动启动类似whatsapp的Android应用程序? - How to Autostart an Android Application like whatsapp? Android使用whatsapp共享深层链接网址并在点击深层链接时打开我的应用 - Android share deep link url using whatsapp and open my app when click deep link 当用户单击Facebook或某些应用程序中的链接并在我的Android应用程序中显示该链接时,如何打开我的Android应用程序? - How to open my android app when a user clicks a link in facebook or some app and display that link in my android app? 如何在我的 android 应用程序上共享来自 whatsapp 的图像和标题 - How to share image and caption from whatsapp on my android application android 中的离线回收器视图,如 whatsapp、Facebook、Gmail 应用程序? - offline recyclerview in android like whatsapp, Facebook, Gmail app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM