skip to Main Content

The idea is, in the app you scan a list of BLE devices. You select one (or more) from it, and once any of those connect or disconnect with the phone, the app can be triggered and send a notification says Your device has connect/disconnect to (BLE device).

Seems it’s doable on Android but after days of researching I haven’t found any documentation can help.

Any insights ?

2

Answers


  1. According to apple documentation there are delegate methods which are called on connect and disconnect

    optional func centralManager(
        _ central: CBCentralManager,
        didConnect peripheral: CBPeripheral
    )
    
    optional func centralManager(
        _ central: CBCentralManager,
        didDisconnectPeripheral peripheral: CBPeripheral,
        error: (any Error)?
    )
    
    Login or Signup to reply.
  2. See Core Bluetooth Background Processing for iOS Apps for full docs. You’ll start a long-running connection request to the known PeripheralID. Whenever the device comes into range, the OS will perform the connection and your app will be launched and you’ll be made aware of the connection. As long as your app continues to communicate with the device, it’ll keep running in the background and you will be able to see a "disconnect" event on the delegate if it occurs.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search