Reputation: 12559
I need to initialize my HostApduService
with an ApduResponse
object, the responses in processCommandApdu
will be created using this ApduResponse
object. I want to initialize my HostApduService
after I get response from network to create my ApduResponse
object. How Can I achieve that?
Upvotes: 1
Views: 1069
Reputation: 7653
As explained in the doc, HCE service is launched when Reader with specific AID is tapped to your device(HCE). https://developer.android.com/guide/topics/connectivity/nfc/hce.html#HceServices
One of the key advantages of a service is that it can run in the background without any user interface. This is a natural fit for many HCE applications like loyalty or transit cards, with which the user shouldn't need to launch the app to use it. Instead, tapping the device against the NFC reader starts the correct service (if not already running) and executes the transaction in the background. Of course, you are free to launch additional UI (such as user notifications) from your service if that makes sense.
To send specific ApduResponse to your service, you need to communicate between your application and your HCE service. Please read this : Passing information to a HostApduService from another Context
Upvotes: 1