我想製作一個簡單的穿戴式應用程序並通過數據層進行連接。一切工作正常與手持模塊(使用:S5),但可穿戴(使用:摩托360)總是拋出的錯誤:Android Wear錯誤ConnectionResult {statusCode = SERVICE_VERSION_UPDATE_REQUIRED,resolution = null}
onConnectionFailed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=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();
}
我已經做了研究,但我找不到任何有效的解決方案。
如果您正在爲磨損設備使用仿真器,請確保您的仿真器具有最新的Android版本。我有一個API 22的模擬器,我得到了錯誤。然後我創建了一個新的API 24(7.0牛軋糖),它的工作。 –