Use this function to determine whether NFCService functionality is available.
Syntax
import { getNFCService } from 'lightning/mobileCapabilities';
isAvailable(): Boolean
Parameters
None.
Returns
Returns true when used on a supported device, and false otherwise.
Usage
Use this function to disable or hide NFC operations on platforms where interacting with NFCs isn’t supported. For example:
handleGetNFCClick(event) {
const myNFCService = getNFCService();
if(myNFCService.isAvailable()) {
// Perform NFC operations
}
else {
// NFCService not available, or consuming app hasn’t implemented it
// Not running on a device with NFC functionality, etc.
// Handle with message, error, beep, and so on
}
}