0

I work on an app that uses google maps a lot. Very often i call this method requestLocationUpadates() method, once in a while this method throws IllegalStateException. Below Pasted is the code that throws the exception and the Log message. Any help is highly appreciated. Thanks !!

gpsLocationDailog.cancel();
if (mLocationClient == null)
mLocationClient = new LocationClient(getApplicationContext(),
                    this, this);
mLocationClient.requestLocationUpdates(REQUEST, this);
mCurrentLocation = mLocationClient.getLastLocation();
fireQueryToGetTheResponse(latitude, longitude);
rl.setVisibility(View.VISIBLE);

This is log message

12-31 10:46:02.993: E/AndroidRuntime(25002): FATAL EXCEPTION: main
12-31 10:46:02.993: E/AndroidRuntime(25002): java.lang.IllegalStateException: Not connected. Call connect() and wait for onConnected() to be called.
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.google.android.gms.internal.de.bc(Unknown Source)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.google.android.gms.internal.ez.a(Unknown Source)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.google.android.gms.internal.ez$c.bc(Unknown Source)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.google.android.gms.internal.ey.requestLocationUpdates(Unknown Source)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.google.android.gms.internal.ez.requestLocationUpdates(Unknown Source)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.google.android.gms.internal.ez.requestLocationUpdates(Unknown Source)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.google.android.gms.location.LocationClient.requestLocationUpdates(Unknown Source)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at org.application.app.squeakee.SqueakeeMapListViewPager.onClick(SqueakeeMapListViewPager.java:1632)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at android.view.View.performClick(View.java:4103)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at android.view.View$PerformClick.run(View.java:17117)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at android.os.Handler.handleCallback(Handler.java:615)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at android.os.Handler.dispatchMessage(Handler.java:92)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at android.os.Looper.loop(Looper.java:137)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at android.app.ActivityThread.main(ActivityThread.java:4744)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at java.lang.reflect.Method.invokeNative(Native Method)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at java.lang.reflect.Method.invoke(Method.java:511)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-31 10:46:02.993: E/AndroidRuntime(25002):    at dalvik.system.NativeStart.main(Native Method)
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
Abby
  • 105
  • 1
  • 1
  • 10
  • http://stackoverflow.com/questions/17056104/gamesclient-not-connecting-error-call-connect-and-wait-for-onconnected-to – Raghunandan Dec 31 '13 at 05:26

1 Answers1

0

You are not connected to googleplayservices it seems like,have a look at this Question ,this will give you better idea of implementing locationclient: Using LocationClient to get Location updates

Community
  • 1
  • 1
praveen
  • 420
  • 4
  • 18