Develop Secure Code
ContactsService Data Types
getContactsService()
isAvailable()
getContacts(options)
isAvailable()Use this function to determine whether ContactsService functionality is available.
1import { getContactsService } from 'lightning/mobileCapabilities';
2isAvailable(): BooleanNone.
Returns true when used on a supported device and false otherwise.
Use this function to disable or hide contacts-related features on platforms where contacts aren’t supported. For example:
1handleFindMeClick() {
2 const myContactsService = getContactsService();
3 if (myContactsService.isAvailable()) {
4 // Perform contacts-related operations
5 }
6 else {
7 // ContactsService isn’t available, or consuming app hasn’t implemented it
8 // Not running on a device with a contacts address book, etc.
9 // Handle with message, error, beep, and so on
10 }
11}See Also