urbanairship-core/src/main/java/com/urbanairship/widget/UAWebViewClient.java
@SuppressLint("NewAPI")
    private void triggerCallback(final WebView webView, String error, ActionValue resultValue, String callbackKey) {
        // Create the callback string
        String callbackString = String.format("'%s'", callbackKey);

        // Create the error string
        String errorString;
        if (error == null) {
            errorString = "null";
        } else {
            errorString = String.format(Locale.US, "new Error(%s)", JSONObject.quote(error));
        }

        // Create the result value
        String resultValueString = resultValue.toString();

        // Create the javascript call for UAirship.finishAction(error, value, callback)
        final String finishAction = String.format(Locale.US, "UAirship.finishAction(%s, %s, %s);",
                errorString, resultValueString, callbackString);

        if (Build.VERSION.SDK_INT >= 19) {
            webView.evaluateJavascript(finishAction, null);
        } else {
            webView.loadUrl("javascript:" + finishAction);
        }
    }
/**
     * Helper method that calls the action callback.
     *
     * @param webView The web view.
     * @param error The error message or null if no error.
     * @param resultValue The actions value of the result.
     * @param callbackKey The key for the callback function in JavaScript.
     */
Helper method that calls the action callback.
@param webView The web view.
@param error The error message or null if no error.
@param resultValue The actions value of the result.
@param callbackKey The key for the callback function in JavaScript.
Helper method that calls the action callback . @param webView The web view . @param error The error message or null if no error . @param resultValue The actions value of the result . @param callbackKey The key for the callback function in JavaScript .
@SuppressLint("NewAPI")
    private void triggerCallback(final WebView webView, String error, ActionValue resultValue, String callbackKey) {
        String callbackString = String.format("'%s'", callbackKey);
        String errorString;
        if (error == null) {
            errorString = "null";
        } else {
            errorString = String.format(Locale.US, "new Error(%s)", JSONObject.quote(error));
        }
        String resultValueString = resultValue.toString();
        final String finishAction = String.format(Locale.US, "UAirship.finishAction(%s, %s, %s);",
                errorString, resultValueString, callbackString);
        if (Build.VERSION.SDK_INT >= 19) {
            webView.evaluateJavascript(finishAction, null);
        } else {
            webView.loadUrl("javascript:" + finishAction);
        }
    }
@ SuppressLint ( "NewAPI" ) private void triggerCallback ( final WebView webView , String error , ActionValue resultValue , String callbackKey ) { String callbackString = String . format ( "'%s'" , callbackKey ) ; String errorString ; if ( error == null ) { errorString = "null" ; } else { errorString = String . format ( Locale . US , "new Error(%s)" , JSONObject . quote ( error ) ) ; } String resultValueString = resultValue . toString ( ) ; final String finishAction = String . format ( Locale . US , "UAirship.finishAction(%s, %s, %s);" , errorString , resultValueString , callbackString ) ; if ( Build . VERSION . SDK_INT >= 19 ) { webView . evaluateJavascript ( finishAction , null ) ; } else { webView . loadUrl ( "javascript:" + finishAction ) ; } }
Helper method that calls the action callback.
Helper method that calls the action callback .
// Create the callback string // Create the error string // Create the result value // Create the javascript call for UAirship.finishAction(error, value, callback)