NFC scan result object
This functionality is available for Creatio 8.3.2 and later.
The NFC scanning operation returns a result object that contains the scan status and, if the scan is successful, NFC tag data.
This object is returned:
- by the
NfcScanService.scan()method when using Freedom UI - in the
onPop()callback when using Classic UI
Learn how to implement NFC scanning in a mobile app: Scan NFC tags in Creatio Mobile.
View the structure of an NFC scan result object below. Depending on the scan outcome, the returned object can contain different properties. Successful scans return NFC tag data in the rawData property. Failed scans can return an explanatory message in the errorMessage property.
{
"type": "success" | "cancelled" | "timeout" | "error" | "unavailable",
"rawData": {
"id": "04:A1:B2:C3:D4:E5:F6",
"type": "iso15693",
"ndefAvailable": true,
"ndefWritable": false
},
"errorMessage": "..."
}
string type
Result of the NFC scanning operation.
Available values
success | The NFC tag was successfully scanned. |
cancelled | The user closed the scanning dialog or tapped the cancel action before a tag was scanned. |
timeout | The scanning session finished because no NFC tag was detected within the timeout period. |
error | An error occurred while attempting to read the NFC tag. |
unavailable | The device does not support NFC, NFC is turned off, or NFC access is unavailable in the current environment. |
object rawData
NFC tag data returned when the scan succeeds. This property is present only when "type": "success".
Parameters
string id | Unique factory-assigned serial number of the NFC tag. For example, "04:A1:B2:C3:D4:E5:F6." | ||||
string type | NFC tag technology type returned for the scanned tag. For example, "iso15693," "mifare_ultralight," or other values depending on the tag technology and mobile platform. | ||||
boolean ndefAvailable | Indicates whether the NFC tag supports NDEF (NFC Data Exchange Format). true The NFC tag supports NDEF and can store NDEF-formatted data. false The NFC tag does not support NDEF or the NDEF capability could not be determined. | ||||
boolean ndefWritable | Indicates whether data can be written to the NFC tag. true Data can be written to the NFC tag. false Data cannot be written to the NFC tag. For example, the tag is read-only or does not support writing. |
string errorMessage
Error details returned when the scan fails. This property is present only when "type": "error" or "type": "unavailable". Use this property for diagnostics or to help determine the cause of the failure. The exact message content depends on the mobile platform and runtime conditions.