Links
💳

NFC

minimum version is v2.10.0
Before reading this page, please make sure you've set up you've enabled NFC.
NFC Bubble Examples:

🧋 Bubble.io Plugin

[Element] Natively - NFC

Fields:
  • Read Alert Message
  • Write Alert Message
  • Read Detected Message
  • Write Detected Message
  • nfcresponse - it's a predefined (by plugin) bubble type that needs to be selected (Natively - NFCResponse type)
Events:
  • NFC Read Failed
  • NFC Write Failed
  • NFC Write Success
  • NFC Read Success
  • NFC Ready To Use - mean you've received 'NFC Is Available' state (Usable for Android)
States:
  • Error
  • Result
  • NFC Tag ID
  • NFC Tag Type
  • NFC Is Available - yes/no (For Android, you need to ask the user to enable it in device settings)
Actions:
  • Read Data
  • Write Data
    • Record Data - text (can be url or just text)To open app with card you can use your bundle id (Like this: com.bundle.id://open?url={url you wanna open}
    • Record ID - text (better to use a shorter ID, for now, it's not usable, so you can hardcode it to some value, but in the future Natively will allow to Write/Read more than 1 data)
How to use?
  1. 1.
    Make sure you've set up NFC for your app
  2. 2.
    (Do not forget to rebuild app)
  3. 3.
    Add Natively - NFC element on the page
  4. 4.
    Fill element fields (Alert messages, etc.)
  5. 5.
    The Banner will set up automatically on the page load
  6. 6.
    Call Read or Write actions

🛠 JavaScript SDK

NativelyNFCService

1
const readAlertMessage = "readAlertMessage";
2
const writeAlertMessage = "writeAlertMessage";
3
const readDetectedMessage = "readDetectedMessage";
4
const writeDetectedMessage = "writeDetectedMessage";
5
6
const nfcService = new NativelyNFCService(
7
readAlertMessage,
8
writeAlertMessage,
9
readDetectedMessage,
10
writeDetectedMessage
11
);
12
13
14
// All available methods (It doesn't mean you need to call them like this):
15
nfcService.read(read_callback);
16
nfcService.write(recordId, recordData, write_callback);
17
nfcService.available(available_callback);
18
// write response
19
// {
20
// "type_format": "nfcWellKnown",
21
// "type": "123",
22
// "id": "123",
23
// "length": 0,
24
// "payload_content": "recordData",
25
// "payload_raw": ""
26
//}
27
28
// How to use?
29
// 1. Call nfcService.available method (you will receive resp.status == true)
30
// 2. Call nfcService.read (you will receive resp.
31
// 3. Call nfcService.write (you need to pass ``recordId (can be hardcoded to "123", we don't use it for now. In the future updates it will be used to Read/Write more than 1 data ), `recordData` (string, can be url or just text), to open app with card you can use your bundle id (Like this: com.bundle.id://open?url={url you wanna open}
32
// 4. Check response resp.status (if it was SUCCESS or FAILED (with error)
33
// resp.status (resp.message if status is FAILED)