[英]Android device emulator is not connecting to Google play services using GoogleApiClient
正如上面提到的,我使用了以下示例:在我的代碼中,《 Android定位新手指南》中,我放置了一個標記以在連接失敗時打印一條錯誤消息,如下所述:
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.i(TAG, "Location services Failed to connect. Please reconnect.");
}
每當我的應用程序連接到Google Play服務時,都會調用此方法。 而我想調用onConnected方法
@Override
public void onConnected(Bundle bundle) {
Log.i(TAG, "Location services connected.");
currentLocation = LocationServices.FusedLocationApi.getLastLocation(
mGoogleApiClient);
Location location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
if(location== null)
{
}
else
{
handleNewLocation(location);
if (currentLocation != null) {
display.setText("Latitude: "+ String.valueOf(currentLocation.getLatitude())+"Longitude: "+
String.valueOf(currentLocation.getLongitude()));
}
}
}
另外我還想補充一點,我的Genymotion VM中已經安裝了Google Play服務,但我無法進入Play商店,所以任何人都可以幫助我請問問題出在哪里?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.