Googleドキュメントで重要なドキュメントが見落とされていることがよくわかりません。私はすでに禿げていない場合、私は私の髪を摘発していただろう。Google Playサービスを確認する
private void checkGooglePlayServices() {
int errorCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this);
boolean isErrorResolvable = GoogleApiAvailability.getInstance().isUserResolvableError(errorCode);
if (isErrorResolvable) {
GoogleApiAvailability.getInstance().getErrorDialog(this, errorCode, REQUEST_CODE_GOOGLE_PLAY_SERVICES).show();
} else {
if (errorCode == ConnectionResult.SUCCESS) {
launchApplication();
}
}
}
上記のコードが持っているというダイアログボックスが表示され、ボタンの読みGET Google Playのサービス:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_GOOGLE_PLAY_SERVICES) {
}
}
今私がここで何をすべき?再生サービスのアップデートを入手するには、ユーザーをプレイストアにどのように誘導する必要がありますか?ここでは、 getErrorResolutionPendingIntent
を使用するとしていますが、これについてどうやって行くのかは分かりません。
私を助けてください。
if (checkPlayServices()) {
// Do your calculation here.
}
private boolean checkPlayServices() {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
.show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
これは、Googleのプレイをチェックするのに役立ちます:
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE)));
}
ありがとうございました。これが私を悩ましていたものです。 –