Set application default payment service

左心房为你撑大大i 提交于 2019-11-30 07:39:34

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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!