I have implemented deeplinking in my application that open my app (if available) but my app opens within other application. I want it should open out of the other app.
我已经在我的应用程序中实现了深度链接,可以打开我的应用程序(如果有),但我的应用程序会在其他应用程序中打开。我希望它应该从其他应用程序中打开。
Here is my code for deeplinking.
这是我的深度链接代码。
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="controller"
android:path="/productDetail"
android:scheme="lalaland" />
</intent-filter>
Example: If i hit a url in slack it opens my app ( lalaland ) with in slack.
例如:如果我在SLACK中点击一个URL,它会在SLACK中打开我的应用程序(Lalaland)。
更多回答
优秀答案推荐
You are at the mercy of the application that the user executed the deep-link from.
你受制于用户执行深度链接的应用程序。
I'm afraid there is no solution for this. For example, Facebook messenger butchers deep-links rendering them unusable in many cases, same with the Samsung messaging app.
恐怕这件事没有解决办法。例如,Facebook Messenger屠宰了深度链接,导致它们在许多情况下无法使用,三星的即时通讯应用也是如此。
What you see here is Slack hijacking the deep-link and forcing it to open within its own app.
你在这里看到的是Slack劫持了深度链接,并迫使它在自己的应用程序中打开。
Stumbled upon this issue the other day and found the following solution from the Android documentation (https://developer.android.com/guide/topics/manifest/activity-element see section about android:launchMode
)
前几天偶然发现了这个问题,并从安卓文档(https://developer.android.com/guide/topics/manifest/activity-element中找到了以下解决方案(请参阅关于安卓的章节:启动模式)
After changing my android:launchMode
from singleTop
to singleInstance
on the <activity>
-element, the universal-/deep-links now moves the users into my app, instead of opening an instance of the app within the Slack app.
在
元素上将My Android:LaunchMode从SingleTop更改为SingleInstance后,通用/深度链接现在将用户移到我的应用程序中,而不是在Slack应用程序中打开该应用程序的实例。
singleTop
allows multiple instances of the same activity to run, unlike singleInstance
which only allows one instance.
SingleTop允许运行同一活动的多个实例,这与只允许一个实例的SingleInstance不同。
This is an old question, but I hope this helps someone else who stumbles upon it, years later (like me)!
这是一个老生常谈的问题,但我希望这能帮助其他几年后偶然发现它的人(像我一样)!
更多回答
Many apps like facebook, tweeter, quora and slack too is opening the app correctly (out of the app)
许多应用程序,如Facebook,Tweeter,Quora和Sack Too都能正确打开应用程序(在应用程序外)
Like i said, its dependant on the app that the user executes the deep-link from. As you have just stated yourself, the implementation has not changed only the executing app.
就像我说的,它依赖于用户执行深度链接的应用程序。正如您刚才所说的,该实现不仅更改了正在执行的应用程序。
我是一名优秀的程序员,十分优秀!