首先 -
我知道有一个类似的问题可以解答。但答案并没有帮助我。
我的问题是一样的 -
使用UPI url如下
String UPI = "upi://pay?pa=xsas@hdfcbank&pn=ABC+DEF&mc=qy67vt&tr=12121&tn=your+order+with+us&am=1.5&url=shopify.com";
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setData(Uri.parse(UPI));
Intent chooser = Intent.createChooser(intent, "Pay with...");
startActivityForResult(chooser, 1, null);
当我使用setData时,我停止获取可与之共享的应用程序列表(列表为空)。如果我删除setData,常规的应用程序列表(短信,电子邮件等)开始弹出,银行应用程序(接受UPI,比如ICICI / HDFC)不是其中之一。
这里可能出现什么问题?,
答案 0 :(得分:0)
替换它:
String UPI = "upi://pay?pa=xsas@hdfcbank&pn=ABC+DEF&mc=qy67vt&tr=12121&tn=your+order+with+us&am=1.5&url=shopify.com";
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setData(Uri.parse(UPI));
Intent chooser = Intent.createChooser(intent, "Pay with...");
startActivityForResult(chooser, 1, null);
用这个:
String UPI = "upi://pay?pa=xsas@hdfcbank&pn=ABC+DEF&mc=qy67vt&tr=12121&tn=your+order+with+us&am=1.5&url=shopify.com";
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW); // this line needs to be updated
intent.setData(Uri.parse(UPI));
Intent chooser = Intent.createChooser(intent, "Pay with...");
startActivityForResult(chooser, 1, null);
这是因为对于所有深度链接的upi应用程序来处理传入的意图,需要使用View Action调用它们。
答案 1 :(得分:0)
您可以从意图中忽略intent.setAction(Intent.ACTION_SEND);
部分,因为这不是强制性的,并且不同的应用将处理不同的操作。
在您提到的原始问题中可以看到,没有setAction