react-native-spike-sdk 4.2.53 β†’ 4.2.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,551 +1,38 @@
1
- Spike ReactNative SDK is a library on top of Apple HealthKit and Android HealthConnect that 
2
1
 
3
- 1. Helps with the extraction of data.
2
+ # Spike SDK
4
3
 
5
- 2. Pushes data to SpikeAPI and delivers standardized data.
4
+ The **Spike SDK** is a cross-platform library built on top of **Apple HealthKit** (iOS) and **Android Health Connect** (Android). It streamlines the extraction, standardization, and transmission of health data, enabling seamless integration with the [SpikeAPI](https://spikeapi.com).
6
5
 
7
- # Table of contents
6
+ ## Key Features
8
7
 
9
- - [Requirements](#requirements)
10
- - [Installation](#installation)
11
- - [iOS Setup](#ios_setup)
12
- - [Android Setup](#android_setup)
13
- - [Check HealthConnect availability (Android Only)](#health_connect_package)
14
- - [Check HealthStore data availability (iOS Only)](#health_store_data)
15
- - [Spike SDK usage](#sdk_usage)
16
- 1. [Create Spike connection](#create_connection)
17
- 2. [Permissions](#permissions)
18
- 3. [Extract data](#extract_data)
19
- - [Background deliveries (iOS Only)](#background_deliveries)
20
- - [Logging](#logging)
21
- - [Spike Data types](#spike_data_types)
22
- - [Classes](#classes)
23
- - [Data types](#data_types)
24
- - [Errors and Exceptions](#exceptions)
8
+ - **Health Data Extraction**
9
+ Effortlessly access health and fitness data from Apple HealthKit and Android Health Connect.
25
10
 
26
- ## Requirements <a name="requirements"></a>
11
+ - **Standardized Data Delivery**
12
+ Collected data is automatically formatted and sent to the SpikeAPI in a consistent, standardized structure.
27
13
 
28
- - iOS 13.0+
14
+ - **Background Data Sync**
15
+ Supports background data delivery on both iOS and Android platforms, ensuring data synchronization with minimal user interaction.
29
16
 
30
- - Android 9.0+
17
+ - **Third-Party Provider Integration**
18
+ Enables direct data collection from external providers such as **Garmin**, **Whoop**, and others, directly through the SDK.
31
19
 
32
- > 🚨 Expo: This package is not available in the [Expo Go](https://expo.io/client) app. Learn how you can use it with [custom dev clients](./Expo.md).
20
+ ## Platform Support
33
21
 
34
- ## Installation <a name="installation"></a>
22
+ - **iOS**: Apple HealthKit
23
+ - **Android**: Android Health Connect
24
+ - **Third-Party**: Garmin, Whoop, and other supported providers
35
25
 
36
- Install the `react-native-spike-sdk` package from [npm](https://www.npmjs.com/package/react-native-spike-sdk)
26
+ ## Use Cases
37
27
 
38
- > yarn add react-native-spike-sdk
28
+ Spike SDK is ideal for developers building health and wellness apps that require:
39
29
 
40
- > npm install react-native-spike-sdk
30
+ - Unified access to health data across platforms
31
+ - Reliable background data synchronization
32
+ - Easy integration with wearable device data
33
+ - Standardized data pipelines for backend processing
41
34
 
42
- Use `pod install` and `pod update` commands from `ios/` folder of your app to install/update pods afterward.
35
+ ## Learn More
43
36
 
44
- ## iOS Setup <a name="ios_setup"></a>
37
+ To get started or explore the API in detail, visit the [official documentation](https://docs.spikeapi.com).
45
38
 
46
- ### iOS Signing & Capabilities
47
-
48
- To add HealthKit support to your application's Capabilities.
49
-
50
- - Open the ios/ folder of your project in Xcode
51
-
52
- - Select the project name in the left sidebar
53
-
54
- - Open `Signing & Capabilities` section
55
-
56
- - In the main view select `+ Capability` and double click `HealthKit`
57
-
58
- - Allow `Clinical Health Records` and `Background Delivery` if needed.
59
-
60
- ![](https://archbee-image-uploads.s3.amazonaws.com/Gq3NSKcNtQuC0xEw-R9rS/m1edxa1O8BQ9j1xchz9Qq_signing-capabilities2x.png)
61
-
62
- More details you can find [here](https://developer.apple.com/documentation/healthkit/setting_up_healthkit).
63
-
64
- ### Info.plist
65
-
66
- Add Health Kit permissions descriptions to your `Info.plist` file.
67
-
68
- ```xml
69
- <key>NSHealthShareUsageDescription</key>
70
- <string>We will use your health information to better track workouts.</string>
71
-
72
- <key>NSHealthUpdateUsageDescription</key>
73
- <string>We will update your health information to better track workouts.</string>
74
-
75
- <key>NSHealthClinicalHealthRecordsShareUsageDescription</key>
76
- <string>We will use your health information to better track workouts.</string>
77
- ```
78
-
79
- ## Android Setup <a name="android_setup"></a>
80
-
81
- First of all you have to add the required health permissions to your "AndroidManifest.xml" file
82
-
83
- ```xml
84
- <uses-permission android:name="android.permission.health.READ_SLEEP"/>
85
- <uses-permission android:name="android.permission.health.READ_WEIGHT"/>
86
- <uses-permission android:name="android.permission.health.READ_ACTIVE_CALORIES_BURNED"/>
87
- <uses-permission android:name="android.permission.health.READ_BASAL_METABOLIC_RATE"/>
88
- <uses-permission android:name="android.permission.health.READ_BLOOD_GLUCOSE"/>
89
- <uses-permission android:name="android.permission.health.READ_BLOOD_PRESSURE"/>
90
- <uses-permission android:name="android.permission.health.READ_BODY_FAT"/>
91
- <uses-permission android:name="android.permission.health.READ_BONE_MASS"/>
92
- <uses-permission android:name="android.permission.health.READ_EXERCISE"/>
93
- <uses-permission android:name="android.permission.health.READ_DISTANCE"/>
94
- <uses-permission android:name="android.permission.health.READ_ELEVATION_GAINED"/>
95
- <uses-permission android:name="android.permission.health.READ_FLOORS_CLIMBED"/>
96
- <uses-permission android:name="android.permission.health.READ_HEART_RATE"/>
97
- <uses-permission android:name="android.permission.health.READ_HEART_RATE_VARIABILITY"/>
98
- <uses-permission android:name="android.permission.health.READ_HEIGHT"/>
99
- <uses-permission android:name="android.permission.health.READ_OXYGEN_SATURATION"/>
100
- <uses-permission android:name="android.permission.health.READ_POWER"/>
101
- <uses-permission android:name="android.permission.health.READ_RESPIRATORY_RATE"/>
102
- <uses-permission android:name="android.permission.health.READ_RESTING_HEART_RATE"/>
103
- <uses-permission android:name="android.permission.health.READ_SPEED"/>
104
- <uses-permission android:name="android.permission.health.READ_STEPS"/>
105
- <uses-permission android:name="android.permission.health.READ_TOTAL_CALORIES_BURNED"/>
106
- <uses-permission android:name="android.permission.health.READ_BODY_TEMPERATURE"/>
107
- ```
108
-
109
- 2. Also add the following query in the <manifest> node:
110
-
111
- ```xml
112
- <queries>
113
- <package android:name="com.google.android.apps.healthdata" />
114
- </queries>
115
- ```
116
-
117
- 3. As well as that you have to add intent filter to your activity definition so that you can request the permissions at runtime. This intent filter reference should be added under the <activity> node, mostly in the <activity android:name=".MainActivity">
118
-
119
- ```xml
120
- <intent-filter>
121
- <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
122
- </intent-filter>
123
- ```
124
-
125
- \*For Android 14 support you also need to add additional intent-filters:
126
-
127
- ```xml
128
- <intent-filter>
129
- <action
130
- android:name="android.intent.action.VIEW_PERMISSION_USAGE"/>
131
- <category
132
- android:name="android.intent.category.HEALTH_PERMISSIONS"/>
133
- </intent-filter>
134
- ```
135
-
136
- 4. For Android 14 support additional manifest element inside application tag
137
-
138
- ```xml
139
- <activity-alias
140
- android:name="ViewPermissionUsageActivity"
141
- android:exported="true"
142
- android:targetActivity=".MainActivity"
143
- android:permission="android.permission.START_VIEW_PERMISSION_USAGE">
144
- <intent-filter>
145
- <action android:name="android.intent.action.VIEW_PERMISSION_USAGE" />
146
- <category android:name="android.intent.category.HEALTH_PERMISSIONS" />
147
- </intent-filter>
148
- </activity-alias>
149
- ```
150
-
151
- 5. In case permissions handling is not working, this might be related to launch mode being `singleTop`. This might be not needed, but some apps faced problems when requesting permissions. If you face them, then you should try removing the following line:
152
-
153
- ```
154
- android:launchMode="singleTop"
155
- ```
156
-
157
- 6. In case app is not building, it might be related to label replacement issue. In this case, you should add the following line to the <application> tag:
158
-
159
- ```
160
- tools:replace="android:label"
161
- ```
162
-
163
- 7. Since we are using closed source native Android SDK, separate repository is needed. Thus, add the following dependency into your android/builde.gradle file (it must be added both in repositories and allprojects node of repositories):
164
-
165
- ```
166
- maven {
167
- url 'https://gitlab.com/api/v4/projects/43396247/packages/maven'
168
- }
169
- ```
170
-
171
- ## Check HealthConnect availability (Android Only) <a name="health_connect_package"></a>
172
-
173
- Check if Health Connect installed on a device.
174
-
175
- ```javascript
176
- const isPackageInstalled = await Spike.isPackageInstalled();
177
- ```
178
-
179
- ## Check HealthStore data availability (iOS Only) <a name="health_store_data"></a>
180
-
181
- Check if Health Store data available on a device.
182
-
183
- ```javascript
184
- const isAvailable = await Spike.isHealthDataAvailable();
185
- ```
186
-
187
- ## Spike SDK usage <a name="sdk_usage"></a>
188
-
189
- Start getting Spike data in 3 steps.
190
- All Spike SDK async method calls should be wrapped into try catch block.
191
-
192
- ### 1. Create Spike connection <a name="create_connection"></a>
193
-
194
- To set up the Spike SDK create [SpikeConnection](#class_SpikeConnection) instance with [SpikeConnectionConfig](#type_SpikeConnectionConfig) object.
195
- From the 2.1.x version Spike SDK automatically manages connection persistance and restore connection if finds one with same `appId`, `authToken` and `customerEndUserId`.
196
- With each new connection creating call `callbackUrl` could be overridden.
197
- Provide [SpikeLogger](#class_SpikeLogger) implementation to handle connection logs.
198
-
199
- ```javascript
200
- import Spike from 'react-native-spike-sdk';
201
-
202
- const conn = await Spike.createConnection(
203
- {
204
- appId: 'my_app_id',
205
- authToken: 'my_app_access_token',
206
- customerEndUserId: 'my_user_id',
207
- callbackUrl: 'my_callback_url', // Optional, provides functionality to send data to webhook and use background deliveries.
208
- },
209
- logger // Optional, class which conforms to SpikeLogger interface
210
- );
211
- ```
212
-
213
- ### 2. Permissions <a name="permissions"></a>
214
-
215
- Provide permissions to access iOS HealthKit and Android HealthConnect data. Spike SDK methods will check required permissions and request them if needed. Permission dialog may not be shown according on platform permissions rules.
216
-
217
- ```javascript
218
- // conn was created in the previous step
219
-
220
- if (Platform.OS === 'android') {
221
- // Android methods should be called on connection instance
222
- const isGranted = await conn.checkPermissionsGranted(
223
- SpikeDataTypes.activitiesStream
224
- );
225
- if (!isGranted) {
226
- await conn.requestHealthPermissions(SpikeDataTypes.activitiesStream);
227
- }
228
-
229
- // Or request multiple permissions
230
- await conn.requestHealthPermissions([
231
- SpikeDataTypes.activitiesStream,
232
- SpikeDataTypes.steps,
233
- ]);
234
- }
235
-
236
- if (Platform.OS === 'ios') {
237
- // iOS method should be called on Spike class
238
- await Spike.ensurePermissionsAreGranted([
239
- SpikeDataTypes.activitiesStream,
240
- SpikeDataTypes.steps,
241
- ]); // Provide required Spike data types
242
- }
243
- ```
244
-
245
- ### 3. Extract data <a name="extract_data"></a>
246
-
247
- There are two ways to get Spike data: to your webhook or directly in your app. Extract data methods requires [SpikeExtractConfig](#type_SpikeExtractConfig) object, where date range can be provided optionally. By providing range greater than one day samples array of result object will be empty. The maximum permitted date range for iOS is 90 days, while for Android it's 30 days.
248
-
249
- #### Extract data locally
250
-
251
- According to the provided [SpikeDataType](#spike_data_types) result object may be different.
252
-
253
- ```javascript
254
- // conn was created in the previous step
255
-
256
- // Extract steps data for today
257
- const data = await conn.extractData({
258
- dataType: SpikeDataTypes.steps,
259
- });
260
-
261
- // OR you can provide same day
262
- const today = new Date() // could be any day
263
- const data = await conn.extractData({
264
- dataType: SpikeDataTypes.steps,
265
- from: today,
266
- to: today
267
- });
268
- ```
269
-
270
- ```javascript
271
- // conn was created in the previous step
272
-
273
- // Extract steps data for yesterday and today.
274
- const today = new Date();
275
- const yesterday = new Date();
276
- yesterday.setDate(today.getDate() - 1);
277
- const data = await conn.extractData({
278
- dataType: SpikeDataTypes.steps,
279
- from: yesterday,
280
- to: today,
281
- });
282
- ```
283
-
284
- #### Extract data to webhook
285
-
286
- Ensure `callbackUrl` was provided to [SpikeConnection](#class_SpikeConnection), otherwise you will get _SpikeCallbackURLNotProvidedException_ error.
287
- Method will return job information object.
288
-
289
- ```javascript
290
- // conn was created in the previous step
291
-
292
- // Send today's steps data to webhook
293
- const data = await conn.extractAndPostData({
294
- dataType: SpikeDataTypes.steps,
295
- });
296
-
297
- // OR you can provide same day
298
- const today = new Date(); // could be any day
299
- const data = await conn.extractAndPostData({
300
- dataType: SpikeDataTypes.steps,
301
- from: today,
302
- to: today,
303
- });
304
- ```
305
-
306
- ```javascript
307
- // conn was created in the previous step
308
-
309
- // Send yesterday's and today's steps data to webhook
310
- const today = new Date();
311
- const yesterday = new Date();
312
- yesterday.setDate(today.getDate() - 1);
313
- const data = await conn.extractAndPostData({
314
- dataType: SpikeDataTypes.steps,
315
- from: yesterday,
316
- to: today,
317
- });
318
- ```
319
-
320
- ## Background deliveries (iOS Only) <a name="background_deliveries"></a>
321
-
322
- Background delivery enables asynchronous data delivery to the customer backend by means of webhooks. It enables data updates to be sent to the backend even when the application is hidden or closed. Background delivery is only supported on iOS devices at the moment. Background deliveries will send whole day data to the webhook.
323
-
324
- ### Configure for background deliveries
325
-
326
- Under your project `Signing & Capabilities` section enable `Background Delivery` for `HealthKit`.
327
- Call Spike configure methods on each app start to trigger background deliveries tasks.
328
- Add Spike initialization code to `ios/<Project Name>/AppDelegate.mm` file inside `application:didFinishLaunchingWithOptions:` method.
329
-
330
- > If you plan on supporting background delivery, you need to set up all observer queries in your app delegate. Spike SDK will do it by calling `configure()` method. Read more [Receive Background Updates](https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery#3801028).
331
-
332
- ```javascript
333
- # import <SpikeSDK/SpikeSDK-Swift.h>
334
- ...
335
-
336
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
337
- {
338
- ...
339
- [Spike configure];
340
- ...
341
-
342
- }
343
- ```
344
-
345
- ### Register connection for background deliveries
346
-
347
- Ensure `callbackUrl` was provided to [SpikeConnection](#class_SpikeConnection), otherwise you will get _SpikeCallbackURLNotProvidedException_ error.
348
- Provide required [Spike Data types](#spike_data_types) to `enableBackgroundDelivery` method, it could be called after connection is created.
349
-
350
- ```javascript
351
- await conn.enableBackgroundDelivery([
352
- SpikeDataTypes.activitiesSummary,
353
- SpikeDataTypes.steps,
354
- ]);
355
- ```
356
-
357
- - If `dataTypes` is not empty, then a daemon task is started which will listen for data updates coming from the platform and send them via webhooks in the background; the operation is not compound and each method call will override enabled background data types list;
358
-
359
- - If `dataTypes` parameter is empty or null, then background data delivery is stopped for this connection if it was enabled;
360
-
361
- You can check if connection have active background deliveries listeners. If background delivery is not enabled, an empty set is returned.
362
-
363
- ```javascript
364
- const dataTypes = await conn.getBackgroundDeliveryDataTypes();
365
- ```
366
-
367
- ## Logging <a name="logging"></a>
368
-
369
- Internally, the React Native SDK supports logging on various levels to assist with troubleshooting. However, to avoid imposing additional third-party dependencies on library users, the SDK expects a concrete logging implementation to be provided externally. This can be done by implementing the [SpikeLogger](#class_SpikeLogger) class and providing it when creating a connection.
370
-
371
- Below is an example of how to implement a simple console logger.
372
-
373
- ```javascript
374
- class ConsoleLogger implements SpikeLogger {
375
- isDebugEnabled() {
376
- return true;
377
- }
378
-
379
- isInfoEnabled() {
380
- return true;
381
- }
382
-
383
- isErrorEnabled() {
384
- return true;
385
- }
386
-
387
- debug(connection: SpikeConnection, message: string) {
388
- console.log(`[SPIKE_DEBUG] ${message}`);
389
- }
390
-
391
- info(connection: SpikeConnection, message: string) {
392
- console.log(`[SPIKE_INFO] ${message}`);
393
- }
394
-
395
- error(connection: SpikeConnection, message: string) {
396
- console.log(`[SPIKE_ERROR] ${message}`);
397
- }
398
- }
399
- ```
400
-
401
- Spike SDK provides background delivery process logs. This can be done by implementing the [SpikeBackgroundDeliveriesLogger](#class_SpikeBackgroundDeliveriesLogger) class and providing it though connection's `setListener` method.
402
-
403
- Below is an example of how to implement a simple console logger.
404
-
405
- ```javascript
406
- class BackgroundDeliveriesLogger implements SpikeBackgroundDeliveriesLogger {
407
- onBackgroundLog(log: string) {
408
- console.log(`[BACKGROUND_LOG] ${log}`);
409
- }
410
- }
411
- ```
412
-
413
- ## Spike Data types <a name="spike_data_types"></a>
414
-
415
- - SpikeDataTypes.activitiesStream
416
- - SpikeDataTypes.activitiesSummary
417
- - SpikeDataTypes.body
418
- - SpikeDataTypes.breathing
419
- - SpikeDataTypes.calories
420
- - SpikeDataTypes.distance
421
- - SpikeDataTypes.ecg
422
- - SpikeDataTypes.glucose
423
- - SpikeDataTypes.heart
424
- - SpikeDataTypes.info
425
- - SpikeDataTypes.oxygenSaturation
426
- - SpikeDataTypes.sleep
427
- - SpikeDataTypes.steps
428
-
429
- ## Classes <a name="classes"></a>
430
-
431
- ### Spike <a name="class_Spike"></a>
432
-
433
- | Class | Method | Description | iOS | Android | |
434
- | ----- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------- | --- |
435
- | Spike | createConnection | Creates a new SpikeConnection instance with the given user details.<br />**Parameters:** config ([SpikeConnectionConfig](#type_SpikeConnectionConfig)), logger? ([SpikeLogger](#class_SpikeLogger)) .<br />**Returns:** An instance of the SpikeConnection class ([SpikeConnection](#class_SpikeConnection)). | yes | yes |
436
- | Spike | getBackgroundConnections | Returns all connections that are configured to deliver data in the background.<br />**Returns:** An array of SpikeConnection instances with callbackUrl (Array\<[SpikeConnection](#class_SpikeConnection)>). | yes | yes |
437
- | Spike | ensurePermissionsAreGranted | Verifies that platform-specific permissions corresponding to the Spike data types provided are granted. In the event that some permissions are not granted, a platform-specific permissions dialogue will be presented to the end-user. This method should only be invoked from a UI component.<br />**Parameters:** permissions (Array\<[SpikeDataType](#spike_data_types)>) | yes | no |
438
- | Spike | isPackageInstalled | Check if Health Connect installed on a device.<br />**Returns:** isInstalled (Bool) | no | yes |
439
- | Spike | isHealthDataAvailable | Check if Health Store data available on the device.<br />**Returns:** isAvailable (Bool) | yes | no |
440
-
441
- ### SpikeConnection <a name="class_SpikeConnection"></a>
442
-
443
- | Class | Method | Description | iOS | Android |
444
- | --------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------- |
445
- | SpikeConnection | getAppId | Retrieves the unique Spike application identifier.<br />**Returns:** appId (string) | yes | yes |
446
- | SpikeConnection | getSpikeEndUserId | Retrieves the unique identifier assigned to the end-user by Spike.<br />**Returns:** spikeEndUserId (string) | yes | yes |
447
- | SpikeConnection | getCustomerEndUserId | Retrieves the unique identifier assigned to the end-user by the customer.<br />**Returns:** customerEndUserId (string) | yes | yes |
448
- | SpikeConnection | getCallbackUrl | Returns the URL that will receive webhook notifications.<br />**Returns:** callbackUrl (string) | yes | yes |
449
- | SpikeConnection | close | Terminates any ongoing connections with Spike’s backend servers, clears any caches, and removes provided user details and tokens from the memory. Once the connection is closed, it cannot be used, and any method other than close() will throw a _SpikeConnectionIsClosedException_ exception. | yes | yes |
450
- | SpikeConnection | extractData | Extracts local device data for the current date in the end-user’s time zone. Optionally time range can be provided.<br />**\*On iOS, the maximum allowed single-query time interval is 90 days. If required, data of any longer time period can be accessed by iterating multiple queries of 90 days.**<br />**\*On Android the earliest date data can be requested for is 30 days before a permission was given to the user's app to read from HealthConnect. There is no limit on how many days in total.**<br />**Parameters:** config ([SpikeExtractConfig](#type_SpikeExtractConfig))<br />**Returns:** An instance of SpikeData. The concrete type will depend on the data type requested | yes | yes |
451
- | SpikeConnection | extractAndPostData | Extracts local device data for the current date in the local user time zone and sends it as a webhook notification to the customer’s backend. Optionally time range can be provided.<br />**\*On iOS, the maximum allowed single-query time interval is 90 days. If required, data of any longer time period can be accessed by iterating multiple queries of 90 days.**<br />**\*On Android the earliest date data can be requested for is 30 days before a permission was given to the user's app to read from HealthConnect. There is no limit on how many days in total.**<br />**Parameters:** config ([SpikeExtractConfig](#type_SpikeExtractConfig)) | yes | yes |
452
- | SpikeConnection | setListener | Sets a listener that is to handle notifications from the background delivery process.<br />**Parameters:** listener ([SpikeBackgroundDeliveriesLogger](#class_SpikeBackgroundDeliveriesLogger))<br />**\*If listener is not null, then any existing listener is replaced** | yes | no |
453
- | SpikeConnection | manageHealthConnect | Opens your device's HealthConnect menu, where you can switch on and off data access for the app as well as delete data. | no | yes |
454
- | SpikeConnection | checkPermissionsGranted | Initiates a check on whether health permissions have been granted for specified data type.<br />**Parameters:** dataType ([SpikeDataType](#spike_data_types))<br />**Returns:** permissions are granted (boolean) | no | yes |
455
- | SpikeConnection | getHealthConnectAvailability | Provides information on whether HealthConnect is available on the device. | no | yes |
456
- | SpikeConnection | revokeAllPermissions | Revokes all granted health permissions for the application. | no | yes |
457
- | SpikeConnection | requestHealthPermissions | Requests all the supported health read permissions for provided data types from HealthConnect.<br />**Parameters:** dataTypes ([SpikeDataType](#spike_data_types) or Array\<[SpikeDataType](#spike_data_types)>) | no | yes |
458
-
459
- ### SpikeLogger <a name="class_SpikeLogger"></a>
460
-
461
- Abstract class allowing to receive notifications from the SDK's processes.
462
-
463
- | Class | Method | Description | iOS | Android |
464
- | ----------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------ | --- | ------- |
465
- | SpikeLogger | isDebugEnabled | Manages is Debug level logging enabled.<br />**Returns**: are Debug level logs enabled (boolean) | yes | yes |
466
- | SpikeLogger | isInfoEnabled | Manages is Info level logging enabled.<br />**Returns**: are Info level logs enabled (boolean) | yes | yes |
467
- | SpikeLogger | isErrorEnabled | Manages is Error level logging enabled.<br />**Returns**: are Error level logs enabled (boolean) | yes | yes |
468
- | SpikeLogger | debug | Invoked on Spike SKD Debug log events.<br />**Parameters**: connection ([SpikeConnection](#class_SpikeConnection)), message (string) | yes | yes |
469
- | SpikeLogger | info | Invoked on Spike SKD Info log events.<br />**Parameters**: connection ([SpikeConnection](#class_SpikeConnection)), message (string) | yes | yes |
470
- | SpikeLogger | error | Invoked on Spike SKD Error log events.<br />**Parameters**: connection ([SpikeConnection](#class_SpikeConnection)), message (string) | yes | yes |
471
-
472
- ### SpikeBackgroundDeliveriesLogger <a name="class_SpikeBackgroundDeliveriesLogger"></a>
473
-
474
- Abstract class allowing to receive notifications from the background data delivery process.
475
-
476
- | Class | Method | Description | iOS | Android |
477
- | ------------------------------- | --------------- | -------------------------------------------------------------------------- | --- | ------- |
478
- | SpikeBackgroundDeliveriesLogger | onBackgroundLog | Invoked on background deliveries events.<br />**Parameters**: log (string) | yes | no |
479
-
480
- ### SpikeConnectionConfig <a name="type_SpikeConnectionConfig"></a>
481
-
482
- Type required to create Spike connection instance.
483
-
484
- | Type | Property | Type | Description | iOS | Android |
485
- | --------------------- | ----------------- | ------ | --------------------------------------------------------------- | --- | ------- |
486
- | SpikeConnectionConfig | appId | string | The unique Spike application identifier | yes | yes |
487
- | SpikeConnectionConfig | authToken | string | The unique identifier assigned to the end-user by Spike. | yes | yes |
488
- | SpikeConnectionConfig | customerEndUserId | string | the unique identifier assigned to the end-user by the customer. | yes | yes |
489
- | SpikeConnectionConfig | callbackUrl | string | URL that will receive webhook notifications | yes | yes |
490
-
491
- ### SpikeExtractConfig <a name="type_SpikeExtractConfig"></a>
492
-
493
- Type required to extract data.
494
-
495
- | Type | Property | Type | Description | iOS | Android |
496
- | ------------------ | -------- | ---------------------------------- | ------------------------------------------------------------------------------ | --- | ------- |
497
- | SpikeExtractConfig | dataType | [SpikeDataType](#spike_data_types) | The Spike data type to make extraction for. | yes | yes |
498
- | SpikeExtractConfig | from | Date (optional) | Extraction time range start date.<br />**\*Required if `to` property passed.** | yes | yes |
499
- | SpikeExtractConfig | to | Date (optional) | Extraction time range end date.<br />**\*Required if `from` property passed.** | yes | yes |
500
-
501
- ## Data types <a name="data_types"></a>
502
-
503
- The following table shows the data types that can be read from HealthConnect API and the permissions that are required to read them.
504
-
505
- | Spike Data Type | HealthConnect permission |
506
- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
507
- | SpikeDataTypes.HEART_RATE | android.permission.health.READ_HEART_RATE<br/>android.permission.health.READ_HEART_RATE_VARIABILITY<br/>android.permission.health.READ_RESTING_HEART_RATE |
508
- | SpikeDataTypes.DISTANCE | android.permission.health.READ_DISTANCE |
509
- | SpikeDataTypes.ACTIVITIES_STREAM | android.permission.health.READ_EXERCISE<br/>android.permission.health.READ_STEPS<br/>android.permission.health.READ_DISTANCE<br/>android.permission.health.READ_TOTAL_CALORIES_BURNED<br/>android.permission.health.READ_HEART_RATE<br/>android.permission.health.READ_SPEED<br/>android.permission.health.READ_ELEVATION_GAINED<br/>android.permission.health.READ_POWER<br/>android.permission.health.READ_HEART_RATE_VARIABILITY |
510
- | SpikeDataTypes.ACTIVITIES_SUMMARY | android.permission.health.READ_STEPS<br/>android.permission.health.READ_ACTIVE_CALORIES_BURNED<br/>android.permission.health.READ_TOTAL_CALORIES_BURNED<br/>android.permission.health.READ_DISTANCE<br/>android.permission.health.READ_ELEVATION_GAINED<br/>android.permission.health.READ_FLOORS_CLIMBED<br/>android.permission.health.READ_HEART_RATE<br/>android.permission.health.READ_RESTING_HEART_RATE<br/>android.permission.health.READ_BASAL_METABOLIC_RATE |
511
- | SpikeDataTypes.BREATHING | android.permission.health.READ_RESPIRATORY_RATE |
512
- | SpikeDataTypes.CALORIES | android.permission.health.READ_TOTAL_CALORIES_BURNED<br/>android.permission.health.READ_ACTIVE_CALORIES_BURNED |
513
- | SpikeDataTypes.GLUCOSE | android.permission.health.READ_BLOOD_GLUCOSE |
514
- | SpikeDataTypes.OXYGEN_SATURATION | android.permission.health.READ_OXYGEN_SATURATION |
515
- | SpikeDataTypes.SLEEP | android.permission.health.READ_SLEEP<br/>android.permission.health.READ_HEART_RATE<br/>android.permission.health.READ_HEART_RATE_VARIABILITY |
516
- | SpikeDataTypes.STEPS | android.permission.health.READ_STEPS |
517
- | SpikeDataTypes.BODY | android.permission.health.READ_WEIGHT<br/>android.permission.health.READ_HEIGHT<br/>android.permission.health.READ_BODY_FAT<br/>android.permission.health.READ_BONE_MASS<br/>android.permission.health.READ_BLOOD_PRESSURE<br/>android.permission.health.READ_BODY_TEMPERATURE |
518
-
519
- ## Errors and Exceptions <a name="exceptions"></a>
520
-
521
- ### SpikeException
522
-
523
- The abstract parent of all concrete exceptions.
524
-
525
- ### SpikeConnectionIsClosedException
526
-
527
- Thrown if any method is invoked on SpikeConnection or one of its subclasses after the connection has been closed.
528
-
529
- ### SpikeInvalidCredentialsException
530
-
531
- Thrown if the credentials provided are not recognised, i.e. are invalid or expired.
532
-
533
- ### SpikeInvalidDateRangeException
534
-
535
- Thrown if duration exceeds the allowed maximum or if β€˜from’ date is greater than β€˜to’ date. The message will contain a specific cause description.
536
-
537
- ### SpikeInvalidCallbackUrlException
538
-
539
- Thrown if the callback URL is not a valid URL, does not have HTTPS schema, or is not a sub-URL of the main callback URL configured for the application. The exception message will contain a specific reason.
540
-
541
- ### SpikePermissionsNotGrantedException
542
-
543
- Thrown when Spike SDK is unable to access the data due to permissions not being granted.
544
-
545
- ### SpikeServerException
546
-
547
- Whenever any operation with the Spike backend fails and the error does not fall into any of the above exceptions. The exception cause will contain the underlying error.
548
-
549
- ### SpikeCallbackURLNotProvidedException
550
-
551
- Thrown when a method which requires callback url is called, but callback url is not set for current connection.
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SPIKE_SDK_VERSION = void 0;
7
7
  // This file is auto-generated. Do not edit manually.
8
- const SPIKE_SDK_VERSION = exports.SPIKE_SDK_VERSION = "4.2.53";
8
+ const SPIKE_SDK_VERSION = exports.SPIKE_SDK_VERSION = "4.2.73";
9
9
  //# sourceMappingURL=version.js.map
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
 
3
3
  // This file is auto-generated. Do not edit manually.
4
- export const SPIKE_SDK_VERSION = "4.2.53";
4
+ export const SPIKE_SDK_VERSION = "4.2.73";
5
5
  //# sourceMappingURL=version.js.map
@@ -1,2 +1,2 @@
1
- export declare const SPIKE_SDK_VERSION = "4.2.53";
1
+ export declare const SPIKE_SDK_VERSION = "4.2.73";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-spike-sdk",
3
- "version": "4.2.53",
4
- "iosVersion": "4.2.31",
3
+ "version": "4.2.73",
4
+ "iosVersion": "4.2.41",
5
5
  "description": "Spike API for health and productivity data from wearables and IoT devices",
6
6
  "main": "lib/commonjs/index",
7
7
  "module": "lib/module/index",
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
- export const SPIKE_SDK_VERSION = "4.2.53";
2
+ export const SPIKE_SDK_VERSION = "4.2.73";
3
3