14

Google Play サービスがインストールされているかどうかを確認する方法の例に従おうとすると、servicesConnected メソッド内の行に「connectionResult を解決できません」というエラーが表示されます。

int errorCode = connectionResult.getErrorCode();

何が欠けている可能性がありますか?コピー&ペーストしてます。ここの例に従っています

ありがとう!

4

2 に答える 2

1

リターンが欠落していると言った場所への解決策は、else の最後に return false を追加することでした。例:

else { // エラーコードを取得

        // Get the error dialog from Google Play services
        Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
                resultCode,
                this,
                CONNECTION_FAILURE_RESOLUTION_REQUEST);

        // If Google Play services can provide an error dialog
        if (errorDialog != null) {
            // Create a new DialogFragment for the error dialog
            ErrorDialogFragment errorFragment =
                    new ErrorDialogFragment();
            // Set the dialog in the DialogFragment
            errorFragment.setDialog(errorDialog);
            // Show the error dialog in the DialogFragment
            errorFragment.show(getSupportFragmentManager(),
                    "Location Updates");
        }
        return false;//THIS NEEDS TO BE FALSE 
    }
于 2014-08-26T04:47:41.653 に答える