我有一个Service
实现GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener, LocationListener
.
因此,当我创建时,Service
我会检查是否Google Play Services
可用,或者是否使用正确的版本:
private boolean servicesConnected() {
// Check that Google Play services is available
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
// If Google Play services is available
if (ConnectionResult.SUCCESS == resultCode) {
return true;
} else {
// Get the error code
GooglePlayServicesUtil
.getErrorDialog(resultCode, this, 0).show();// This won't work in a service
}
}//end
那么,如果我返回一个错误代码,我该如何响应它(向用户显示Dialog
带有选项的 a),因为我在 a 中Service
?在这种情况下,最佳做法是什么?