Set application default payment service

前端 未结 1 1474
深忆病人
深忆病人 2020-12-30 15:08

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.<

相关标签:
1条回答
  • 2020-12-30 15:29

    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);
    
    0 讨论(0)
提交回复
热议问题