NFC

This page describes how to control NFC on a Cuttlefish device using the Cuttlefish NFC feature. NFC is supported on Cuttlefish devices running Android 15 or higher.

Use Casimir

The Cuttlefish NFC feature uses Casimir, an external NFC device simulation tool, which supports injecting APDU bytes for host card emulation. Casimir is implemented in /platform/system/nfc/tools/casimir/.

When launching Cuttlefish, Casimir is also launched by default. To control Casimir, use the CasimirControlService service.

CasimirControlService

You can use the CasimirControlService service through the REST API or the command line interface. For details, see Cuttlefish: Environment Control.

The following table describes the method in CasimirControlService. For more information, see casimir_control.proto.

Method Description
SendApdu Sends APDU bytes (hex strings) with NFC-A and ISO-DEP. The response is returned as hex strings.

The following is an example command and a simplified response for sending two APDU bytes, [0x00, 0x11, 0x22] and [0x33, 0x44, 0x55].

  • Command

    cvd env call CasimirControlService SendApdu '{apdu_hex_strings: ["001122", "334455"]}'
    
  • Simplified response

    Rpc succeeded with OK status
    {
    "responseHexStrings": [
      "9000",
      "9000",
    ]
    }