[英]Android Wear Intent Filter
I'm trying to use a custom intent filter to call the android wear activity. 我正在尝试使用自定义的意图过滤器来调用android wear活动。 (not sure this is the best idea?) However, after registering the intent filter on the wear application, and deploying the mobile application I get the error: (不确定这是最好的主意吗?)但是,在Wear应用程序上注册了意图过滤器并部署了移动应用程序后,我得到了错误消息:
Applications have the same package name com.nybblemouse.datalayerdatamap:
mobile, wear
Can anyone offer some advise? 谁能提供一些建议?
Background information: 背景资料:
I'm developing an android wear application which is using the data layer API to allow a http connection to hit a simple API and show the response on the watch app. 我正在开发一个Android Wear应用程序,该应用程序使用数据层API来允许http连接命中简单的API并在watch应用程序上显示响应。
I've used the data layer API to successfully ask the mobile app to make the call, and now want to call the activity on the watch to display the results. 我已经使用数据层API成功地要求移动应用程序进行调用,现在想在手表上调用活动以显示结果。
Android Wear manifest: Android Wear清单:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.nybblemouse.datalayerdatamap.MainActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name=".ListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
</application>
In my seperate listener service class (for the data layer api), after successful http response: 成功http响应后,在我单独的侦听器服务类(用于数据层api)中:
Intent chilliIntent = new Intent();
chilliIntent.setAction("com.nybblemouse.datalayerdatamap.MainActivity");
chilliIntent.putExtra("CHILLIS", "10");
startActivity(chilliIntent);
After some extensive research, I've created a sample Android Studio project demonstrating how this can be achieved. 经过大量研究后,我创建了一个示例Android Studio项目,演示了如何实现这一目标。 In short, all network traffic needs to go through Android Wear API, namely the Message API or the Data Layer API. 简而言之,所有网络流量都需要通过Android Wear API(即消息API或数据层API)进行。 This is rumoured to change in the upcoming Google IO event on 2015/05/27 with support of native wifi on Wear devices. 有传言称,在即将到来的2015年5月27日Google IO事件中,Wear设备将支持本机wifi,这一情况将发生变化。
The process to call an activity on the Wear device from the Mobile device is as follows (assuming you've chosen the Data Layer API): 从移动设备调用Wear设备上的活动的过程如下(假设您已选择数据层API):
I've documented this very throughly with DFD's, slides and an example project. 我已经用DFD,幻灯片和示例项目非常详尽地记录了这一点。 You can view them all on my Github project: 您可以在我的Github项目中查看所有内容:
https://github.com/kirgy/fandos https://github.com/kirgy/fandos
This project was presented to the South West Mobile user group in Bristol, UK in May 2015: http://www.meetup.com/swmobile/events/220749834/ 该项目已于2015年5月提交给英国布里斯托尔的西南移动用户组: http : //www.meetup.com/swmobile/events/220749834/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.