【问题标题】:Android device emulator is not connecting to Google play services using GoogleApiClientAndroid 设备模拟器未使用 GoogleApiClient 连接到 Google Play 服务
【发布时间】:2015-11-27 16:07:11
【问题描述】:

正如上面提到的,我使用了以下示例:The Beginner’s Guide to Location in 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 store,所以任何人都可以帮助我知道问题出在哪里?

【问题讨论】:

标签: android android-emulator android-location genymotion-gps android-gps


【解决方案1】:

在“”中写入标签词,然后尝试

Log.i("TAG", "定位服务连接失败,请重新连接。");

如果您使用的是 android studio,请在日志级别中选择错误并在其中搜索您的 TAG。

【讨论】:

    猜你喜欢
    • 2015-08-02
    • 1970-01-01
    • 2015-08-14
    • 2011-10-11
    • 1970-01-01
    • 2017-06-24
    • 2011-12-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多