You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用RemoteIntent从智能手表启动移动端配套应用

解决方案

问题根因

你当前使用的隐式Intent缺少启动新任务的标记,且配套应用端的Manifest配置没有完全匹配Intent规则,导致无法唤醒未在后台运行的应用。

第一步:配置手机端配套应用的Manifest

在你需要被拉起的Activity节点下添加如下intent-filter,Android 12及以上必须显式声明android:exported="true":

<activity
    android:name=".你要拉起的Activity全路径"
    android:exported="true">
    <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="myApplication"
            android:host="launch" />
    </intent-filter>
</activity>

第二步:修改Wear端的调用代码

补全Uri的完整结构,添加启动新任务的Flag:

Intent intentAndroid = new Intent(Intent.ACTION_VIEW)
                            .addCategory(Intent.CATEGORY_BROWSABLE)
                            .setData(Uri.parse("myApplication://launch"))
                            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
RemoteIntent.startRemoteActivity(context, intentAndroid, null);

可选更稳定方案:显式Intent调用

如果不需要系统匹配逻辑,直接指定配套应用的包名和Activity路径,兼容性更好:

Intent intentAndroid = new Intent()
        .setComponent(new ComponentName("你的配套应用包名", "你的配套应用Activity完整类名"))
        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
RemoteIntent.startRemoteActivity(context, intentAndroid, null);

注意:请确保Wear设备与手机已正常配对,Wear OS核心服务运行无异常。

内容的提问来源于stack exchange,提问作者SST

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.01 20:27:01