2016-04-05 18 views
0

私が呼び出しています内側GoogleApiClientを初期化する方法:UIスレッド

GoogleApiClient client = new GoogleApiClient.Builder(this.context) 
      .addApi(Wearable.API) 
      .addConnectionCallbacks(this) 
      .addOnConnectionFailedListener(this) 
      .build(); 
    client.connect(); 
UIスレッド内の

onConnected(バンドルバンドル)が呼び出されません。

私は間違っていますか?

+0

'onConnectionSuspended'または' onConnectionFailed'が呼び出されていないことを確認しましたか? – Bharatesh

+0

はい、私はそれをテストしました –

答えて

0

@Saarピア、別の回避策を試すこともできます。 GoogleApiClientとそれを実装するServiceを使用し、それはConnectionCallbacksです。サービスのonStart(またはonStartCommand)内には、googleApiClientを接続します。

GoogleApiClient client = new GoogleApiClient.Builder(ServiceName.class) 
      .addApi(Wearable.API) 
      .addConnectionCallbacks(this) 
      .addOnConnectionFailedListener(this) 
      .build(); 
    client.connect(); 
関連する問題