The application i\'m working on, works properly sometimes but some other times it gives me this error
FATAL EXCEPTION: java.lang.RuntimeException: Una
You should not call loc.createLocationRequest();
immediate after you call loc.buildGoogleApiClient();
Instead you call loc.createLocationRequest()
in onConected()
of ApiCLient. loc.createLocationRequest()
requires the GoogleApiClient to be connected by the time it is called.
For that matter, you should call any API that needs APiCLient connected in onConnected()
. This way you avoid ApiClient connect exceptions while you use them.
This is coming late but for whoever it might be useful for:
loc.buildGoogleApiClient();
to the onCreate method.loc.createLocationRequest();
to the onConnected method.