简体   繁体   中英

Android device emulator is not connecting to Google play services using GoogleApiClient

As it's mentioned above I have used the following example: The Beginner's Guide to Location in Android in my code I putted a tag to print an error message whenever the connection failed as it's mentioned below :

@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
    Log.i(TAG, "Location services Failed to connect. Please reconnect.");

}

when ever my application is connecting to the google play services this method is invoked. while I want onConnected method to be invoked

 @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()));
        }
    }

}

also in addition I want to add something more, google play services are already installed in my Genymotion VM but I cannot get inside the play store, so any one can help me please to know from where the problem come from?

wirte Tag word in "" and then try

Log.i("TAG", "Location services Failed to connect. Please reconnect.");

if you are using android studio then select the error in the log level and serach your TAG in it.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM