android - Deep likeing 不适用于 gmail 应用程序,但适用于其他浏览器
问题描述
https://example.com/public/change_phone?email_recovery_code=F08fjfU39Ea6RSlDzM8ZZJFVwyjAE
<activity android:name=".view.activity.sign_in_new_number.SignInNewNumberActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:scheme="https"
android:host="example.com"
android:pathPrefix="/public/change_phone"/>
</intent-filter>
</activity>
我使用了上面的清单设置,但它不适用于 Gmail 应用程序,URL 不会在我的应用程序上重定向我,只需打开 Gmail 应用程序中的链接
解决方案
如果启动屏幕是您应用程序中的第一个屏幕..然后在启动活动的 onCreate() 上使用它:
首先获取您通过深度链接获得的网址
Intent intent = getIntent();
Uri data = intent.getData();
if (!isTaskRoot()) {//this will resume your app from last loaded screen if you pressed home button earlier
Log.e("splashfin", "hello");
if (data != null) {
//open that activity through your url or do what ever you want
}else{}
}else{
if(data!=null){
//open that activity through your url or do what ever you want
}
}
推荐阅读
- python - JSON文件不读取熊猫
- amazon-web-services - AWS 教程 - 将 Docker 映像推送到 AWS ECR 错误 x509
- android - 启用数据绑定时“无法解决:com.android.support:support-core-utils:24.0.0”
- java - 通过在java中创建对象来引用接口
- symfony - 递归 symfony 3.4 复杂形式嵌入
- github - 有没有办法以编程方式/快速将回购中的所有问题分配给项目?
- php - 网络服务器上的 Laravel 路由
- firebase - 确定 auth 中的用户是否具有 firebase 管理员角色
- python - 如何检查字符串中的字符是否为非字母?
- node.js - Express 提供来自另一台服务器的静态文件