首页 > 解决方案 > 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 应用程序中的链接

标签: androiddeep-linking

解决方案


如果启动屏幕是您应用程序中的第一个屏幕..然后在启动活动的 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

}

 }

推荐阅读