This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Query about the Nordic Scanner Lib on IOs

Dear Nordic team,

 

We are developing a BLE application for IOS and Android.  On Android, we utilized your Nordic Scanner Lib to scan Bluetooth devices and it is fine and convenient for us.

But on IOS, I found it is pretty simple and easy to call the IOS native API, scanForPeripherals(), directly.  Could you please tell me what is the difference between the IOS

API and Nordic Scanner Lib?  Or what is the advantage to scan device by utilizing Nordic Lib rather than the IOS direct API?   

Best regards,

Richard

Parents
  • Hello Richard,

    Android scanning API for Bluetooth LE device was first introduced in Android 4.3, where Google added support for BLE to Android. The initial API was very simple, but also very limited. Basically, there was just one method: https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#startLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback) to start scanning, and another one to stop. The second option (BluetoothAdapter), with list of service UUIDs, was working only with 16-bit UUIDs and was not used in practice.

    In Android Lollipop the API has changed. BluetoothLeScanner was introduced and this object gives more options. Different filters, different scanning modes, etc. If you develop an app for Android 4.3+ you'd have to implement scanner for older platforms (4.3 and 4.4.x) and for newer (5+) to utilize the benefits of new API. The API was also a bit extended in the future.

    To make it easy we made the https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library library, which allows you to use the newest API and it translates it to the older for you. Not all features are possible to mimic (e.g. scanning with PendingIntent, introduced in Android 8 is not possible), but most are.

    On iOS there was no API change. There is just one method that optionally takes list of service UUIDs, but works very well. You don't have control over how iOS will scan, more or less efficiently, as Apple has a different approach then Google. They think they know better, so the API is simple, and it is the system that sets all parameters. Google, on the other hand, gives the freedom to the developer. As there is just one API on iOS, there is no need for any compat library there.

    Hope that answered your question.

    BR, Aleksander

Reply
  • Hello Richard,

    Android scanning API for Bluetooth LE device was first introduced in Android 4.3, where Google added support for BLE to Android. The initial API was very simple, but also very limited. Basically, there was just one method: https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#startLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback) to start scanning, and another one to stop. The second option (BluetoothAdapter), with list of service UUIDs, was working only with 16-bit UUIDs and was not used in practice.

    In Android Lollipop the API has changed. BluetoothLeScanner was introduced and this object gives more options. Different filters, different scanning modes, etc. If you develop an app for Android 4.3+ you'd have to implement scanner for older platforms (4.3 and 4.4.x) and for newer (5+) to utilize the benefits of new API. The API was also a bit extended in the future.

    To make it easy we made the https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library library, which allows you to use the newest API and it translates it to the older for you. Not all features are possible to mimic (e.g. scanning with PendingIntent, introduced in Android 8 is not possible), but most are.

    On iOS there was no API change. There is just one method that optionally takes list of service UUIDs, but works very well. You don't have control over how iOS will scan, more or less efficiently, as Apple has a different approach then Google. They think they know better, so the API is simple, and it is the system that sets all parameters. Google, on the other hand, gives the freedom to the developer. As there is just one API on iOS, there is no need for any compat library there.

    Hope that answered your question.

    BR, Aleksander

Children
Related