GoogleApiClient fails for Android Wear API requires update but I'm already updated -
i'm trying setup google wear app, on mobile side, i'm trying create googleapiclient uses wearable api, error saying need update (service_version_update_required). phone @ latest version of google play services. used standard android studio create wizard create app wear app, , main activity (and added "" manifest.
import android.app.activity; import android.app.dialog; import android.os.bundle; import android.util.log; import com.google.android.gms.common.connectionresult; import com.google.android.gms.common.googleplayservicesutil; import com.google.android.gms.common.api.googleapiclient; import com.google.android.gms.wearable.wearable; public class myactivity extends activity implements googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener { private googleapiclient mgoogleapiclient; private string tag = "myapp"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_my); mgoogleapiclient = new googleapiclient.builder(this) .addapi(wearable.api) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .build(); } @override protected void onstart() { super.onstart(); mgoogleapiclient.connect(); } @override //connectioncallbacks public void onconnected(bundle connectionhint) { log.d(tag, "google api client connected"); } @override //connectioncallbacks public void onconnectionsuspended(int cause) { log.d(tag, "connection google api client suspended"); } @override //onconnectionfailedlistener public void onconnectionfailed(connectionresult result) { log.d(tag, "failed connect"); dialog d = googleplayservicesutil.geterrordialog(result.geterrorcode(), this, 0); d.show(); } }
i had problem on eclipse (not sure if problem on android studio, give try if haven't solved yet). solution found use older version of google play services library in wear project.
the latest version of library (as of today, it's 7095000) not work emulator can create using eclipse. reverted older version had (version 6587000) , googleapiclient
connects fine.
if don't have older version, check out this answer links several earlier versions. latest can there version 6171000 (download link). it's older 1 have should work.
Comments
Post a Comment