[英]Trying to add Deep Linking my Android App
我的应用程序运行良好,但每当我在我的清单中添加深层链接代码时,我的应用程序午餐图标就会消失,这是我的清单文件
<activity
android:name=".login.LoginActivity"
android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
<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" />
<data android:host="gizbo.ae" />
</intent-filter>
</activity>
每当我添加这三行进行深度链接时。 应用程序图标启动图标从设备上消失。
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https" />
<data android:host="gizbo.ae" />
即使我删除了这两行
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
又是同样的问题。
我只想让我的应用程序在谷歌搜索中可见,我正在关注此链接
您必须使用多个 intent-filter 标签:
<activity
android:name=".login.LoginActivity"
android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<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" />
<data android:host="gizbo.ae" />
</intent-filter>
</activity>
您必须添加另一个活动才能使用深度链接,然后启动您的登录活动并将您的数据传递给它。
所以声明活动如下:
<activity
android:name=".DeelinkActivity"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
<!-- URL scheme -->
<intent-filter>
<data android:host="gizbo.ae"
android:scheme="https" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<!-- End URL scheme -->
</activity>
然后在该活动的 onCreate 中,您也可以从那里调用登录活动,您可以将数据传递给该活动。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
//put code to pass data as extras and Start your login activity here
}
祝你好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.