Android HCE Development Configuration Aid Response Relationship summary

Source: Internet
Author: User

The development of the HCE function must be used to hostapduservice, the use of hostapduservice need to configure hostapduservice corresponding aid, the same phone may install multiple HCE apps, Or the same app contains multiple hostapduservice, it's time to figure out the response backwards between the configured aid and the corresponding hostapduservice.

First, we introduce the aid configuration problem for Hostapduservice, which has two modes: other and payment

First Kind

The second Kind


Let us elaborate on the response of the aid in different modes ( premise: A mobile phone, a, b two HCE APP, through the reader to the mobile phone to send APDU selection instructions )

1, A and B application aid is set to the payment mode,

Only the default payment app currently selected by the phone will respond, and the other app's aid selection instructions will not respond.

2, A and B application aid is set to the other mode,

When the aid of A and B are the same, the system pops up a dialog box, listing A and b for the user to select.

If the aid of A and B are different, then there is no interaction between the two apps.

The application aid settings for 3, A and B are payment (a) and other (b) modes, respectively,

If A and B have the same aid, only a will respond to the selection instruction.

If the aid of A and B are different, then the two do not affect each other


Finally, how to determine whether the current HCE app is the default payment program and how to set it as the default payment procedure to contribute to everyone

private void Checkisdefaultapp () {cardemulation Cardemulationmanager = cardemulation.getinstance ( Nfcadapter.getdefaultadapter (this)); ComponentName paymentservicecomponent = new ComponentName (Getapplicationcontext (), CardMangerService.class.getCanonicalName ()); if (!cardemulationmanager.isdefaultserviceforcategory ( Paymentservicecomponent, cardemulation.category_payment)) {Intent Intent = new Intent (cardemulation.action_change_ DEFAULT); Intent.putextra (cardemulation.extra_category,cardemulation.category_payment); Intent.putextra ( cardemulation.extra_service_component,paymentservicecomponent); Startactivityforresult (intent, 0); L.D ("TAG", "current app is not default payment, need to set manually");} else {L.D ("TAG", "Current application is system default payment program");}}




Android HCE Development Configuration Aid Response Relationship summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.