最新遇到一個需要從快應(yīng)用跳轉(zhuǎn)到Android App的需求,以下記錄下實現(xiàn)的方式。
1.在需要跳轉(zhuǎn)的目標(biāo)安卓App的activity中添加對外的schema,示例代碼如下:
<activity
android:label="@7F070043"
android:name="com.huawei.phoneservice.HelpCenterActivity"
android:exported="true"
android:excludeFromRecents="true"
android:launchMode="2"
android:configChanges="0x40002D84">
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"> </category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="hwphoneservice" android:host="externalapp"></data>
</intent-filter>
</activity>
2.在快應(yīng)用中通過system.router.push接口調(diào)用跳轉(zhuǎn),即router.push接口傳入上步配置的schema:
router.push({uri:"hwphoneservice://externalapp/service"})
快應(yīng)用push接口使用方法詳見API文檔:
https://developer.huawei.com/consumer/cn/doc/development/quickApp-References/quickapp-api-router