设置应用程序默认付款服务 [英] Set application default payment service

查看:271
本文介绍了设置应用程序默认付款服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们考虑一下用户安装了多个能够进行NFC HCE付款的应用程序的情况.这些应用程序服务在"NFC点击付款"设置下可见.

Let's think about a case where user has installed multiple applications capable of NFC HCE payments. Those application services are visible under settings NFC Tap and Pay.

如果没有,如何以编程方式将您的应用程序更改为默认付款服务?

How to programmatically change your application to be the default payment service if it's not?

CardEmulation似乎仅具有用于查询类别服务是否默认的API.

CardEmulation seems only to have API to query if service for category is default.

谢谢.

推荐答案

拥有该UI的主要思想是用户可以决定哪个支付应用应为默认应用.因此,没有没有方法可以以编程方式 将您的应用设置为默认应用.

The main idea behind having that UI is that the user can decide on which payment app should be the default app. Consequently, there is no way to programmatically set your app to be the default.

但是,您可以请求用户将您的应用设置为付款类别的默认应用(请参见

However, you can request the user to set your app as default app for the payment category (see ACTION_CHANGE_DEFAULT):

Intent intent = new Intent();
intent.setAction(CardEmulation.ACTION_CHANGE_DEFAULT);
intent.putExtra(CardEmulation.EXTRA_SERVICE_COMPONENT,
                new ComponentName(this, my.package.MyPaymentService.class));
intent.putExtra(CardEmulation.EXTRA_CATEGORY, CardEmulation.CATEGORY_PAYMENT);

startActivity(intent);

这篇关于设置应用程序默认付款服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆