urbanairship-core/src/main/java/com/urbanairship/actions/RateAppActivity.java
private void displayDialog() {
        if (dialog != null && dialog.isShowing()) {
            return;
        }

        Intent intent = getIntent();
        if (intent == null) {
            Logger.error("RateAppActivity - Started activity with null intent.");
            finish();
            return;
        }

        final Uri storeUri = intent.getParcelableExtra(RateAppAction.STORE_URI_KEY);

        if (storeUri == null) {
            Logger.error("RateAppActivity - Missing store URI.");
            finish();
            return;
        }



        AlertDialog.Builder builder;
        Context context = this;
        builder = new AlertDialog.Builder(context);

        if (intent.getStringExtra(RateAppAction.TITLE_KEY) != null) {
            builder.setTitle(intent.getStringExtra(RateAppAction.TITLE_KEY));
        } else {
            String title = context.getString(R.string.ua_rate_app_action_default_title, getAppName());
            builder.setTitle(title);
        }

        if (intent.getStringExtra(RateAppAction.BODY_KEY) != null) {
            builder.setMessage(intent.getStringExtra(RateAppAction.BODY_KEY));
        } else {
            String positiveButtonTitle = context.getString(R.string.ua_rate_app_action_default_rate_positive_button);
            String body = context.getString(R.string.ua_rate_app_action_default_body, positiveButtonTitle);
            builder.setMessage(body);
        }

        builder.setPositiveButton(
                context.getString(R.string.ua_rate_app_action_default_rate_positive_button),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        try {
                            Intent openLinkIntent = new Intent(Intent.ACTION_VIEW, storeUri);
                            startActivity(openLinkIntent);
                        } catch (ActivityNotFoundException e) {
                            Logger.error("No web browser available to handle request to open the store link.", e);
                        }

                        dialog.cancel();
                        finish();
                    }
                });


        builder.setNegativeButton(
                context.getString(R.string.ua_rate_app_action_default_rate_negative_button),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                        finish();
                    }
                });

        builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                dialog.cancel();
                finish();
            }
        });

        dialog = builder.create();
        dialog.setCancelable(true);
        dialog.show();
    }
/**
     * Displays the Rate App prompt that links to an app store.
     */
Displays the Rate App prompt that links to an app store.
Displays the Rate App prompt that links to an app store .
private void displayDialog() {
        if (dialog != null && dialog.isShowing()) {
            return;
        }
        Intent intent = getIntent();
        if (intent == null) {
            Logger.error("RateAppActivity - Started activity with null intent.");
            finish();
            return;
        }
        final Uri storeUri = intent.getParcelableExtra(RateAppAction.STORE_URI_KEY);
        if (storeUri == null) {
            Logger.error("RateAppActivity - Missing store URI.");
            finish();
            return;
        }
        AlertDialog.Builder builder;
        Context context = this;
        builder = new AlertDialog.Builder(context);
        if (intent.getStringExtra(RateAppAction.TITLE_KEY) != null) {
            builder.setTitle(intent.getStringExtra(RateAppAction.TITLE_KEY));
        } else {
            String title = context.getString(R.string.ua_rate_app_action_default_title, getAppName());
            builder.setTitle(title);
        }
        if (intent.getStringExtra(RateAppAction.BODY_KEY) != null) {
            builder.setMessage(intent.getStringExtra(RateAppAction.BODY_KEY));
        } else {
            String positiveButtonTitle = context.getString(R.string.ua_rate_app_action_default_rate_positive_button);
            String body = context.getString(R.string.ua_rate_app_action_default_body, positiveButtonTitle);
            builder.setMessage(body);
        }
        builder.setPositiveButton(
                context.getString(R.string.ua_rate_app_action_default_rate_positive_button),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        try {
                            Intent openLinkIntent = new Intent(Intent.ACTION_VIEW, storeUri);
                            startActivity(openLinkIntent);
                        } catch (ActivityNotFoundException e) {
                            Logger.error("No web browser available to handle request to open the store link.", e);
                        }
                        dialog.cancel();
                        finish();
                    }
                });
        builder.setNegativeButton(
                context.getString(R.string.ua_rate_app_action_default_rate_negative_button),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                        finish();
                    }
                });
        builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                dialog.cancel();
                finish();
            }
        });
        dialog = builder.create();
        dialog.setCancelable(true);
        dialog.show();
    }
private void displayDialog ( ) { if ( dialog != null && dialog . isShowing ( ) ) { return ; } Intent intent = getIntent ( ) ; if ( intent == null ) { Logger . error ( "RateAppActivity - Started activity with null intent." ) ; finish ( ) ; return ; } final Uri storeUri = intent . getParcelableExtra ( RateAppAction . STORE_URI_KEY ) ; if ( storeUri == null ) { Logger . error ( "RateAppActivity - Missing store URI." ) ; finish ( ) ; return ; } AlertDialog . Builder builder ; Context context = this ; builder = new AlertDialog . Builder ( context ) ; if ( intent . getStringExtra ( RateAppAction . TITLE_KEY ) != null ) { builder . setTitle ( intent . getStringExtra ( RateAppAction . TITLE_KEY ) ) ; } else { String title = context . getString ( R . string . ua_rate_app_action_default_title , getAppName ( ) ) ; builder . setTitle ( title ) ; } if ( intent . getStringExtra ( RateAppAction . BODY_KEY ) != null ) { builder . setMessage ( intent . getStringExtra ( RateAppAction . BODY_KEY ) ) ; } else { String positiveButtonTitle = context . getString ( R . string . ua_rate_app_action_default_rate_positive_button ) ; String body = context . getString ( R . string . ua_rate_app_action_default_body , positiveButtonTitle ) ; builder . setMessage ( body ) ; } builder . setPositiveButton ( context . getString ( R . string . ua_rate_app_action_default_rate_positive_button ) , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int id ) { try { Intent openLinkIntent = new Intent ( Intent . ACTION_VIEW , storeUri ) ; startActivity ( openLinkIntent ) ; } catch ( ActivityNotFoundException e ) { Logger . error ( "No web browser available to handle request to open the store link." , e ) ; } dialog . cancel ( ) ; finish ( ) ; } } ) ; builder . setNegativeButton ( context . getString ( R . string . ua_rate_app_action_default_rate_negative_button ) , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int id ) { dialog . cancel ( ) ; finish ( ) ; } } ) ; builder . setOnCancelListener ( new DialogInterface . OnCancelListener ( ) { @ Override public void onCancel ( DialogInterface dialog ) { dialog . cancel ( ) ; finish ( ) ; } } ) ; dialog = builder . create ( ) ; dialog . setCancelable ( true ) ; dialog . show ( ) ; }
Displays the Rate App prompt that links to an app store.
Displays the Rate App prompt that links to an app store .