努兰已经指出了正确的答案.
替换您的方法
protected void IsPlayServicesAvailable() { int resultCode = GoogleApiAvailability.isGooglePlayServicesAvailable(this); if (resultCode == ConnectionResult.SUCCESS){ msgText.setText("isGooglePlayServicesAvailable SUCCESS"); } else { GoogleApiAvailability.getErrorDialog(this, resultCode, 1).show(); } }
通过
protected void IsPlayServicesAvailable() { int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this); if (resultCode == ConnectionResult.SUCCESS){ msgText.setText("isGooglePlayServicesAvailable SUCCESS"); } else { GoogleApiAvailability.getInstance().getErrorDialog(this, resultCode, 1).show(); } }