1

I am writing an app that uses Google's location services. From what I understand, when I call the connect() method on a LocationClient object, the object that implementsGooglePlayServicesClient.ConnectionCallbacks is supposed to receive an onConnected() callback only if the LocationClient succeeds in connecting to Google's location services.

The problem, however, is that I receive this callback even if my phone is not connected to the internet. Somehow, the system must think that the LocationClient is successfully connecting to Google's location services even though my phone is not connected to the internet.

What gives?

Here are the relevant code snippets:

@Override
protected void onStart() {
    super.onStart();
    mLocationClient.connect();
}

@Override
public void onConnected(Bundle bundle) {
    Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show();
}
4

1 回答 1

3

onConnected当您的应用成功连接到 Google Play Services 应用时,将调用回调方法。您无需连接到互联网即可接收 GPS 更新。

于 2013-11-03T00:56:22.050 回答