Android wear app can't connect to google api services

后端 未结 2 408
别跟我提以往
别跟我提以往 2021-01-16 23:15

I\'m trying to set up a connection between Android Wear and an Android phone. The googleApiClient fails to connect, and returns a SERVICE_VERSION_UPDATE_REQUIRED status code

2条回答
  •  醉酒成梦
    2021-01-16 23:44

    Looks like putting the googleClient.connect() on onStart() solves the issue:

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
    
        // Build a new GoogleApiClient
        checkIfGoogleApiClientExists();
        googleClient = new GoogleApiClient.Builder(this)
                .addApi(Wearable.API)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .build();
    }
    
    @Override
    protected void onStart() {
        Log.i(LOG_TAG,"entered onStart");
        super.onStart();
        googleClient.connect();
    }
    

提交回复
热议问题