只要链接中有“tel:”标签,我就会尝试打开我自己的应用程序。 所以我正在使用这样的 intent-filter:
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="tel" />
</intent-filter>
但是当点击一个链接时,我的应用程序会在浏览器中打开(当查看所有打开的应用程序时,我可以在浏览器中看到我的应用程序窗口,以及我已经在后台打开的应用程序)。
我如何判断 Intent (重新)打开我的应用程序而不是在浏览器(或触发 Intent 的其他应用程序)内?
我使用 cordova webintent 插件打开应用程序:
https://github.com/Initsogar/cordova-webintent.git
通过以下调用在 javascript 中实现:
window.plugins.webintent.onNewIntent(returnTelIntent);
window.plugins.webintent.getUri(returnTelIntent);
function returnTelIntent() {};
最佳答案
您需要更改 Android 启动模式。看这里:
http://inthecheesefactory.com/blog/understand-android-activity-launchmode/en
关于Android Intent 在其他应用程序中打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29487953/