Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓:安卓的硬件实现不起作用_Android_Webview_Payment Gateway_Ccavenue - Fatal编程技术网

Android 安卓:安卓的硬件实现不起作用

Android 安卓:安卓的硬件实现不起作用,android,webview,payment-gateway,ccavenue,Android,Webview,Payment Gateway,Ccavenue,我正在我的android应用程序中实现CCAvenue支付网关,但当我重定向到webviewactivity(CCAvenue的支付页面)时,它会显示空白屏幕。我不确定我做错了什么。所以我在这里发布我的webviewactivty代码和logcat。请调查一下 WebViewActivity: public class WebViewActivity extends AppCompatActivity { private ProgressDialog dialog; Intent

我正在我的android应用程序中实现CCAvenue支付网关,但当我重定向到webviewactivity(CCAvenue的支付页面)时,它会显示空白屏幕。我不确定我做错了什么。所以我在这里发布我的webviewactivty代码和logcat。请调查一下

WebViewActivity:

public class WebViewActivity extends AppCompatActivity {
    private ProgressDialog dialog;
    Intent mainIntent;
    String html, encVal;

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_web_view);
        mainIntent = getIntent();

        // Calling async task to get display content
        new RenderView().execute();
    }

    /**
     * Async task class to get json by making HTTP call
     * */
    private class RenderView extends AsyncTask<Void, Void, Void> {
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            // Showing progress dialog
            dialog = new ProgressDialog(WebViewActivity.this);
            dialog.setMessage("Please wait...");
            dialog.setCancelable(false);
            dialog.show();
        }

        @Override
        protected Void doInBackground(Void... arg0) {
            // Creating service handler class instance
            ServiceHandler sh = new ServiceHandler();

            // Making a request to url and getting response
            ContentValues params = new ContentValues();
            params.put(AvenuesParams.ACCESS_CODE, mainIntent.getStringExtra(AvenuesParams.ACCESS_CODE));
            params.put(AvenuesParams.ORDER_ID, mainIntent.getStringExtra(AvenuesParams.ORDER_ID));

            String vResponse = sh.makeServiceCall(mainIntent.getStringExtra(AvenuesParams.RSA_KEY_URL), ServiceHandler.POST, params);
            System.out.println(vResponse);
            if(!ServiceUtility.chkNull(vResponse).equals("")
                    && ServiceUtility.chkNull(vResponse).toString().indexOf("ERROR")==-1){
                StringBuffer vEncVal = new StringBuffer("");
                vEncVal.append(ServiceUtility.addToPostParams(AvenuesParams.AMOUNT, mainIntent.getStringExtra(AvenuesParams.AMOUNT)));
                vEncVal.append(ServiceUtility.addToPostParams(AvenuesParams.CURRENCY, mainIntent.getStringExtra(AvenuesParams.CURRENCY)));
                encVal = RSAUtility.encrypt(vEncVal.substring(0,vEncVal.length()-1), vResponse);
            }

            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);
            // Dismiss the progress dialog
            if (dialog.isShowing())
                dialog.dismiss();

            @SuppressWarnings("unused")
            class MyJavaScriptInterface
            {
                @JavascriptInterface
                public void processHTML(String html)
                {
                    // process the html as needed by the app
                    String status = null;
                    if(html.indexOf("Failure")!=-1){
                        status = "Transaction Declined!";
                    }else if(html.indexOf("Success")!=-1){
                        status = "Transaction Successful!";
                    }else if(html.indexOf("Aborted")!=-1){
                        status = "Transaction Cancelled!";
                    }else{
                        status = "Status Not Known!";
                    }
                    //Toast.makeText(getApplicationContext(), status, Toast.LENGTH_SHORT).show();
                    Intent intent = new Intent(getApplicationContext(),StatusActivity.class);
                    intent.putExtra("transStatus", status);
                    startActivity(intent);
                }
            }

            final WebView webview = (WebView) findViewById(R.id.webview);
            webview.getSettings().setJavaScriptEnabled(true);
            webview.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
            webview.setWebViewClient(new WebViewClient(){
                @Override
                public void onPageFinished(WebView view, String url) {
                    super.onPageFinished(webview, url);
                    if(url.indexOf("/ccavResponseHandler.jsp")!=-1){
                        webview.loadUrl("javascript:window.HTMLOUT.processHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
                    }
                }

                @Override
                public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                    Toast.makeText(getApplicationContext(), "Oh no! " + description, Toast.LENGTH_SHORT).show();
                }
            });

            /* An instance of this class will be registered as a JavaScript interface */
            StringBuffer params = new StringBuffer();
            params.append(ServiceUtility.addToPostParams(AvenuesParams.ACCESS_CODE,mainIntent.getStringExtra(AvenuesParams.ACCESS_CODE)));
            params.append(ServiceUtility.addToPostParams(AvenuesParams.MERCHANT_ID,mainIntent.getStringExtra(AvenuesParams.MERCHANT_ID)));
            params.append(ServiceUtility.addToPostParams(AvenuesParams.ORDER_ID,mainIntent.getStringExtra(AvenuesParams.ORDER_ID)));
            params.append(ServiceUtility.addToPostParams(AvenuesParams.REDIRECT_URL,mainIntent.getStringExtra(AvenuesParams.REDIRECT_URL)));
            params.append(ServiceUtility.addToPostParams(AvenuesParams.CANCEL_URL,mainIntent.getStringExtra(AvenuesParams.CANCEL_URL)));
            params.append(ServiceUtility.addToPostParams(AvenuesParams.ENC_VAL, encVal));

            String vPostParams = params.substring(0, params.length() - 1);

            try {
                String postData = URLEncoder.encode(vPostParams, "UTF-8");
                webview.postUrl(Constants.TRANS_URL, postData.getBytes());
            } catch (Exception e) {
                showToast("Exception occured while opening webview.");
            }
        }
    }

    public void showToast(String msg) {
        Toast.makeText(this, "Toast: " + msg, Toast.LENGTH_LONG).show();
    }
}
而不是这个代码 params.append(ServiceUtility.addToposParams(AvenuesParams.ENC_VAL,encVal))

试试这个代码

ENC_VAL,URLEncoder.Encode(encVal)

通常,对于CCavenueTransation,您应该将所需参数附加到CCAvenueTransaction url

在webview中。在此之前,您应该对加密数据进行编码,因为它可能包含问号(?)、符号(&)、斜杠(/)和空格等字符。它可能被webview或浏览器截断或损坏。因此,CCAVENCE服务器无法理解您的参数

01-22 15:51:48.794 22477-22477/com.shivam.ccavenue D/cr_Ime: [ImeAdapter.java:241] attach
01-22 15:51:49.222 22477-25871/com.shivam.ccavenue E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
01-22 15:51:51.096 22477-22477/com.shivam.ccavenue W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 22477
01-22 15:52:01.178 22477-22488/com.shivam.ccavenue W/art: Suspending all threads took: 40.657ms
01-22 15:52:01.471 22477-22477/com.shivam.ccavenue D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
01-22 15:52:01.501 22477-22477/com.shivam.ccavenue D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
01-22 15:52:01.552 22477-22477/com.shivam.ccavenue D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
01-22 15:52:02.108 22477-22493/com.shivam.ccavenue I/art: Background sticky concurrent mark sweep GC freed 30638(1760KB) AllocSpace objects, 9(186KB) LOS objects, 17% free, 9MB/11MB, paused 990us total 112.272ms
01-22 15:52:02.190 22477-22477/com.shivam.ccavenue D/cr_Ime: [ImeAdapter.java:604] detach
01-22 15:52:05.619 22477-26807/com.shivam.ccavenue W/chromium: [WARNING:gin_java_bridge_message_filter.cc(111)] WebView: Unknown frame routing id: 1
01-22 15:52:08.970 22477-22488/com.shivam.ccavenue W/art: Suspending all threads took: 79.102ms
01-22 15:52:08.972 22477-22477/com.shivam.ccavenue D/cr_Ime: [InputMethodManagerWrapper.java:27] Constructor
01-22 15:52:09.010 22477-22477/com.shivam.ccavenue D/cr_Ime: [ImeAdapter.java:241] attach
01-22 15:52:09.014 22477-22477/com.shivam.ccavenue W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-22 15:52:09.069 22477-22477/com.shivam.ccavenue W/AwContents: onDetachedFromWindow called when already detached. Ignoring
01-22 15:52:09.069 22477-22477/com.shivam.ccavenue D/cr_Ime: [InputMethodManagerWrapper.java:56] isActive: false
01-22 15:52:09.253 22477-22477/com.shivam.ccavenue I/Choreographer: Skipped 40 frames!  The application may be doing too much work on its main thread.
01-22 15:52:09.633 22477-22578/com.shivam.ccavenue I/System.out: !ERROR!Required parameters not found.��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
01-22 15:52:09.734 22477-22477/com.shivam.ccavenue W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-22 15:52:09.734 22477-22477/com.shivam.ccavenue W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-22 15:52:09.873 22477-22477/com.shivam.ccavenue D/cr_Ime: [ImeAdapter.java:241] attach
01-22 15:52:09.952 22477-22477/com.shivam.ccavenue D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
01-22 15:52:09.952 22477-22477/com.shivam.ccavenue D/cr_Ime: [AdapterInputConnection.java:145] Constructor called with outAttrs: inputType=0xa1 imeOptions=0x12000000 privateImeOptions=null
                                                             actionLabel=null actionId=0
                                                             initialSelStart=0 initialSelEnd=0 initialCapsMode=0x0
                                                             hintText=null label=null
                                                             packageName=com.shivam.ccavenue fieldId=2131492955 fieldName=null
                                                             extras=null
01-22 15:52:10.014 22477-22477/com.shivam.ccavenue D/cr_Ime: [ImeAdapter.java:241] attach
01-22 15:52:10.773 22477-22477/com.shivam.ccavenue W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 22477