我想制作一个简单的可穿戴应用程序并通过数据层进行连接。一切工作正常与手持模块(使用:S5),但可穿戴(使用:摩托360)总是抛出错误:
onConnectionFailed :ConnectionResult {statusCode = SERVICE_VERSION_UPDATE_REQUIRED,resolution = null}
掌上电脑的播放服务是最新的
我已经添加了
compile'com.google.android.gms:play -services:7.3.0'这两个手持设备,就像穿戴build.gradle一样。 / p>
可穿戴式活动:
@Override 保护无效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。文字); } }); int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); Log.i(TAG,可用服务:+结果); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks(){ @Override public void onConnected(Bundle connectionHint){ Log .d(TAG,onConnected:+ connectionHint); //现在你可以使用数据层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); } }) //只能访问Wearable API .addApi(Wearable.API) .build(); $ b $ @覆盖保护无效onStart(){ super.onStart(); Log.i(TAG,== OnStart ===); mGoogleApiClient.connect(); }我已经完成了研究,但找不到任何可行的解决方案。
解决方案当我在华硕ZenWatch上使用Google Play服务时,出现类似问题,
可穿戴总是抛出错误:
ConnectionResult {statusCode = SERVICE_VERSION_UPDATE_REQUIRED,resolution = null
Google Play服务已过期。需要7327000,但找到了6774534
我发现可穿戴设备和手持设备的Google Play服务可能不同步,我不知道为什么。 p>
因此,请检查可穿戴式Google Play服务版本。 设置 - >关于 - >软件版本
和重新同步应用程序
启动Android Wear应用程序 - >点击齿轮图标 - >选择您的设备 - >重新同步
等待3-5分钟,检查可穿戴Google Play服务版本。
当同步是完整的,也许你可以工作。
希望你明白我的英文坏了。
I've wanted to make an easy wearable app and connect through the data layer. Everything works fine with the handheld module (using: S5), but the wearable (using: Moto 360) always throw the error:
onConnectionFailed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null}
The play services at the handheld are up-to-date
I've added
compile 'com.google.android.gms:play-services:7.3.0'to both, the handheld, as the wear build.gradle.
The wearable Activity:
@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(); }I've done research, but I couldn't find any working solution.
解决方案I have a similar problem when I use Google Play Services on ASUS ZenWatch,
In wearable always throw error:
ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null
Google Play services out of date. Requires 7327000 but found 6774534
I found wearable and handheld Google Play Services may be not syncing, I don't know why.
So, check wearable Google Play Services version
Settings -> About -> Software version
And resync apps
Launch Android Wear app -> Click the gear icon -> select your device -> Resync apps
Wait 3-5 minute , check wearable Google Play Services version.
When sync is complete, maybe you can work it.
Hope you understand my broken English.
更多推荐
Android Wear错误ConnectionResult {statusCode = SERVICE
发布评论