Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Service Exception:can't deliver broadcast #39

Open
shivam21 opened this issue Jan 23, 2019 · 0 comments
Open

Remote Service Exception:can't deliver broadcast #39

shivam21 opened this issue Jan 23, 2019 · 0 comments

Comments

@shivam21
Copy link

shivam21 commented Jan 23, 2019

Device Used: OnePlus 5
App State: Background
Occurs very rarely

Stacktrace:

android.app.ActivityThread$H.handleMessage (ActivityThread.java:1867)

  | android.os.Handler.dispatchMessage (Handler.java:106)
  | android.os.Looper.loop (Looper.java:164)
  | android.app.ActivityThread.main (ActivityThread.java:6753)
  | java.lang.reflect.Method.invoke (Method.java)
  | com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:482)
  | com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)

Code Used:
Must be occuring while registering broadcast

` try {
Class.forName("com.payu.custombrowser.Bank");
final Bank bank = new Bank() {
@OverRide
public void registerBroadcast(BroadcastReceiver broadcastReceiver, IntentFilter filter) {
mReceiver = broadcastReceiver;
registerReceiver(broadcastReceiver, filter);
}

            @Override
            public void unregisterBroadcast(BroadcastReceiver broadcastReceiver) {
                if (mReceiver != null) {
                    unregisterReceiver(mReceiver);
                    mReceiver = null;
                }
            }

            @Override
            public void onHelpUnavailable() {
                findViewById(R.id.parent).setVisibility(View.GONE);
                findViewById(R.id.trans_overlay).setVisibility(View.GONE);
            }

            @Override
            public void onBankError() {
                findViewById(R.id.parent).setVisibility(View.GONE);
                findViewById(R.id.trans_overlay).setVisibility(View.GONE);
            }

            @Override
            public void onHelpAvailable() {
                findViewById(R.id.parent).setVisibility(View.VISIBLE);
            }
        };
        Bundle args = new Bundle();
        args.putInt(Bank.WEBVIEW, R.id.webview);
        args.putInt(Bank.TRANS_LAYOUT, R.id.trans_overlay);
        args.putInt(Bank.MAIN_LAYOUT, R.id.r_layout);
        args.putBoolean(Bank.VIEWPORTWIDE, viewPortWide);
        args.putString(Bank.TXN_ID, txnId == null ? String.valueOf(System.currentTimeMillis()) : txnId);
        args.putString(Bank.MERCHANT_KEY, null != merchantKey ? merchantKey : "could not find");
        PayUSdkDetails payUSdkDetails = new PayUSdkDetails();
        args.putString(Bank.SDK_DETAILS, payUSdkDetails.getSdkVersionName());
        if (getIntent().getExtras().containsKey("showCustom")) {
            args.putBoolean(Bank.SHOW_CUSTOMROWSER, getIntent().getBooleanExtra("showCustom", false));
        }
        args.putBoolean(Bank.SHOW_CUSTOMROWSER, true);
        args.putBoolean(Bank.MERCHANT_SMS_PERMISSION, true);//set true for android M,false otherwise args.putBoolean(Bank.AUTO_SELECT_OTP, true); // enable auto opt click in choose page args.putBoolean(Bank.AUTO_APPROVE, true); // enable auto approve as soon as otp received args.putInt(Bank.STORE_ONE_CLICK_HASH, PayUConstants.STORE_ONE_CLICK_HASH_SERVER); bank.setArguments(args); findViewById(R.id.parent).bringToFront(); try { getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in, R.anim.cb_face_out).add(R.id.parent, bank).commit(); }catch(Exception e) { e.printStackTrace(); finish(); } mWebView.setWebChromeClient(new PayUWebChromeClient(bank)); mWebView.setWebViewClient(new PayUWebViewClient(bank)); mWebView.postUrl(url, payuConfig.getData().getBytes()); // add if using PayU SDK (new PayuUtils()).deviceAnalytics(PaymentsActivity.this, Bank.Version, merchantKey, txnId); } catch (ClassNotFoundException e) { mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); mWebView.getSettings().setSupportMultipleWindows(true); mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // Setting view port for NB if(viewPortWide){ mWebView.getSettings().setUseWideViewPort(viewPortWide); } // Hiding the overlay View transOverlay = findViewById(R.id.trans_overlay); transOverlay.setVisibility(View.GONE); mWebView.addJavascriptInterface(new Object() { @JavascriptInterface public void onSuccess() { onSuccess(""); } @JavascriptInterface public void onSuccess(final String result) { runOnUiThread(new Runnable() { @Override public void run() { Intent intent = new Intent(); intent.putExtra("result", result); setResult(RESULT_OK, intent); finish(); } }); } @JavascriptInterface public void onFailure() { onFailure(""); } @JavascriptInterface public void onFailure(final String result) { runOnUiThread(new Runnable() { @Override public void run() { Intent intent = new Intent(); intent.putExtra("result", result); setResult(RESULT_CANCELED, intent); finish(); } }); } }, "PayU"); mWebView.setWebChromeClient(new WebChromeClient() ); mWebView.setWebViewClient(new WebViewClient()); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.postUrl(url, payuConfig.getData().getBytes()); // add if using PayU SDK (new PayuUtils()).deviceAnalytics(PaymentsActivity.this, Bank.Version, merchantKey, txnId);
    }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant