So, I have this code:
package com.entu.bocterapp; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.os.Bundle; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; public class LocationManager implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private Context mContext; private GoogleApiClient mGoogleApiClient; private Location mLastLocation; private LocationRequest mLocationRequest; public LocationManager(Context context) { mContext = context;
I am trying to get the location in this class, but onConnected () is never called (I waited 1-2 minutes). I went with a debugger, it says google play services are available.
Does anyone know what I'm doing wrong? Iโm stuck here for hours, I read everything and canโt get it to work.
Hooray!
source share