Android Wear - start wear activity from handheld action

别说谁变了你拦得住时间么 提交于 2019-11-29 11:04:55

Have a look at the DataLayer sample included in the Android SDK Manager for API 20. It contains an example of how to start up an activity on the wearable after a user presses a button on the mobile device.

that probably is done with a bit of hackery.

create your own action and make the Wear.activity <intent-filter to use it. Something like:

    <intent-filter>
        <action android:name="com.myCompany.myApp.ACTION.openWearActivity" />
    </intent-filter>

then on your notification intent, created from the phone, you know it, just use that one:

new Intent("com.myCompany.myApp.ACTION.openWearActivity");

and voila !

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!