我想制作一个简单的可穿戴应用程序并通过数据层连接.手持模块(使用:S5)一切正常,但可穿戴设备(使用:Moto 360)总是抛出错误:
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(); }
我做过研究,但找不到任何有效的解决方案.
解决方法
当我在华硕ZenWatch上使用Google Play服务时遇到类似的问题,
在穿戴中总是抛出错误:
ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_required,resolution=null
Google Play services out of date. Requires 7327000 but found 6774534
我发现可穿戴和手持式Google Play服务可能没有同步,我不知道为什么.
因此,请检查可穿戴的Google Play服务版本
设置 – >关于 – >软件版本
并重新同步应用程序
启动Android Wear应用 – >点击齿轮图标 – >选择您的设备 – >重新同步应用
等待3-5分钟,检查可穿戴的Google Play服务版本.
同步完成后,也许您可以使用它.
希望你能理解我破碎的英语.