[英]How do I open Paytm app from Intent using Android?
I'm creating a food delivery app for restaurants for a university campus. 我正在为大学校园的餐馆创建送餐应用程序。 Most of these restaurants accept Paytm as a payment method. 这些餐厅大多数都接受Paytm作为付款方式。
I want to add a button in my app to launch the Paytm app with the mobile number of the vendor and the amount of order filled in. So the user only has to press one button to complete the payment.I don't even need to receive payment confirmation from Paytm. 我想在我的应用程序中添加一个按钮以启动Paytm应用程序,其中包含供应商的手机号码和填写的订单金额。因此,用户只需按一个按钮即可完成付款。我什至不需要收到Paytm的付款确认。
I can't use the payment API because it'll restrict the payment to only one account for which the API key is generated. 我无法使用付款API,因为它将付款限制为仅为其生成API密钥的一个帐户。
If it's not possible via intents, is it possible via deep linking? 如果通过意图无法实现,是否可以通过深度链接实现?
I don't know how to open it directly, but so far I came up with the below code. 我不知道如何直接打开它,但是到目前为止,我想到了下面的代码。 It opens the browser and it will redirect to the app. 它将打开浏览器,并将重定向到该应用程序。
String url = "http://m.p-y.tm";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
you can use package name of PayTm like this, 您可以这样使用PayTm的软件包名称,
String appPackageName = "net.one97.paytm";
PackageManager pm = getContext().getPackageManager();
Intent appstart = pm.getLaunchIntentForPackage(appPackageName);
if(null!=appstart)
{
getContext().startActivity(appstart);
}
else {
Toast.makeText(getContext(), "Install PayTm on your device", Toast.LENGTH_SHORT).show();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.