【问题标题】:Exception when calling Intent to load UPI Payment App : android.content.ActivityNotFoundException: No Activity found to handle Intent调用 Intent 加载 UPI Payment App 时出现异常:android.content.ActivityNotFoundException: No Activity found to handle Intent
【发布时间】:2017-05-25 06:10:44
【问题描述】:

我正在尝试使用来自 Android IONIC(Javascript) 应用程序的 UPI 发起付款

我得到以下异常

android.content.ActivityNotFoundException:未找到处理 Intent 的 Activity { act=android.intent.action.SEND dat=upi://pay?pa=recipient@hdfc&pn=recipient_name&am=102.00&tn =Test_Transaction }

01-10 21:58:32.334 E/PluginManager(29853):在 android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1792)

01-10 21:58:32.334 E/PluginManager(29853): 在 android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)

我的设备上有 3 个启用 UPI 的应用程序:Yes bank 的 BHIM 和 PhonePe 以及 ICICI 的 iMobile

这是一段代码

  window.plugins.webintent.startActivity({
      action: window.plugins.webintent.ACTION_VIEW,
      url: upiUrl
    },
    function()
    {
      console.log("After calling startActivity");
    },
    function() {
      console.log("Failed to open URL via Android Intent. URL: " + upiUrl)
    }
  );

【问题讨论】:

  • 你也应该发送tid。

标签: android android-intent payment upi


【解决方案1】:

您可以创建自定义插件并使用 Intent 代码。下面是我为Expense Sharing Cordova App 编写的代码。您可以使其适合 IONIC。

cordova.getThreadPool().execute(new Runnable() {
            @Override
            public void run() {
                if(Build.VERSION.SDK_INT<16){
                    callbackContext.error("This feature is available only for Android version Jelly Bean and higher");
                    return;
                }
                try {
                    JSONObject jo = data.getJSONObject(0);
                    String upi_vpa = jo.getString("upi_vpa");
                    String name = jo.getString("name");
                    String UPI = "upi://pay?pa="+upi_vpa+"&pn="+name+"&tn=#Repay-GCF&cu=INR";
                    Intent intent = new Intent();
                    intent.setAction(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse(UPI));
                    Intent chooser = Intent.createChooser(intent, "Send Money with...");
                    cordova.getActivity().startActivityForResult(chooser, MainActivity.UPI_PAY_REQUEST, null);
                }catch (JSONException e){
                    e.printStackTrace();
                }
            }
        });

【讨论】:

  • 谢谢 Sandeep UPI 应用程序的响应如何。 UPI 应用程序是否会说 BHIM 将返回成功失败,如 UPI 深度链接文档中所述?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-02
  • 2016-02-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多