我想做一个简单的可穿戴应用程序并通过数据层进行连接。手持模块(使用:S5)一切正常,但可穿戴设备(使用:Moto 360)总是抛出错误:
onConnectionFailed:ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED,分辨率=null}
手持设备上的播放服务是最新的
我已经添加
compile 'com.google.android.gms:play-services:7.3.0'
对两者来说,手持设备,作为穿戴 build.gradle。
可穿戴活动:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
mTextView = (TextView) stub.findViewById(R.id.text);
}
});
int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
Log.i(TAG,"Services available: "+ result);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle connectionHint) {
Log.d(TAG, "onConnected: " + connectionHint);
// Now you can use the Data Layer API
}
@Override
public void onConnectionSuspended(int cause) {
Log.d(TAG, "onConnectionSuspended: " + cause);
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
Log.d(TAG, "onConnectionFailed: " + result);
}
})
// Request access only to the Wearable API
.addApi(Wearable.API)
.build();
}
@Override
protected void onStart() {
super.onStart();
Log.i(TAG, "==OnStart===");
mGoogleApiClient.connect();
}
我已经进行了研究,但找不到任何可行的解决方案。