polarofficial / polar-ble-sdk

Repository includes SDK and code examples. More info https://polar.com/en/developers
Other
447 stars 147 forks source link

Several Polar api SDK instances #412

Open biosignalssolutions opened 8 months ago

biosignalssolutions commented 8 months ago

Platform your question concerns:

Device:

Description: I would appreciate it if you could answer the following questions:

1.- Can I recover a Polar API SDK instance created in an activity, from another activity? I have read that I can only create a single instance. I have two activities, one to search for the sensors and another to communicate.

2.- Can I communicate with several sensors at the same time using a single Polar SDK instance? or should have to create multiple instances of sdk polar api?

3.- In the function, public void bleSdkFeatureReady(@NonNull final String identifier, Is the identifier the same as polarDeviceInfo.getDeviceId() ?

Thanks

samulimaa commented 3 months ago

Hello,

  1. I would solve this by using repository pattern and creating a new repository class where you initialize your PolarBleApi instance. You could access this repository class (singleton) from your activity classes to access PolarBleApi.

  2. Only one sensor connected at the same time is currently supported.

  3. Yes, device ID or BT MAC address are valid identifiers.