Skip to content

Instantly share code, notes, and snippets.

@Naveen-spritle
Last active June 22, 2023 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Naveen-spritle/04bba277751c2d885eb073308a4ff8d9 to your computer and use it in GitHub Desktop.
Save Naveen-spritle/04bba277751c2d885eb073308a4ff8d9 to your computer and use it in GitHub Desktop.
Perform the Scan BLE device Operation if Bluetooth adapter state is ON and Granted the required Permissions
//CUSTOM HOOK
const isBluetoothOn = useBluetoothListener(); // We made above the code snippet, Whenever needed import and use it.
useEffect(() => {
// Perform the Scan BLE device Operation if Bluetooth adapter state is ON and Granted the required Permissions
isBluetoothOn && accessPermission && scanAvailableBleDevice();
}, [isBluetoothOn, accessPermission]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment