react-native-spike-sdk 1.0.21 → 1.0.22

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
@@ -43,6 +43,59 @@ Add Health Kit permissions descriptions to your Info.plist file.
43
43
  <string>We will use your health information to better track workouts.</string>
44
44
  ```
45
45
 
46
+ ## Android Setup
47
+
48
+ First of all you have to add the required health permissions to a [resource file](https://developer.android.com/guide/topics/resources/providing-resources). You can reuse an existing one or create a new one. That allows you to fully utilise this SDK and to read the necessary data from apps that integrate with HealthConnect.
49
+
50
+ ```xml
51
+ <resources>
52
+ <array name="health_permissions">
53
+ <item>androidx.health.permission.Nutrition.READ</item>
54
+ <item>androidx.health.permission.ActiveCaloriesBurned.READ</item>
55
+ <item>androidx.health.permission.TotalCaloriesBurned.READ</item>
56
+ <item>androidx.health.permission.Steps.READ</item>
57
+ <item>androidx.health.permission.Distance.READ</item>
58
+ <item>androidx.health.permission.ElevationGained.READ</item>
59
+ <item>androidx.health.permission.RestingHeartRate.READ</item>
60
+ <item>androidx.health.permission.HeartRateVariabilityRmssd.READ</item>
61
+ <item>androidx.health.permission.FloorsClimbed.READ</item>
62
+ <item>androidx.health.permission.BasalMetabolicRate.READ</item>
63
+ <item>androidx.health.permission.SleepSession.READ</item>
64
+ <item>androidx.health.permission.HeartRate.READ</item>
65
+ <item>androidx.health.permission.ExerciseSession.READ</item>
66
+ <item>androidx.health.permission.Speed.READ</item>
67
+ <item>androidx.health.permission.Power.READ</item>
68
+ <item>androidx.health.permission.OxygenSaturation.READ</item>
69
+ <item>androidx.health.permission.BloodGlucose.READ</item>
70
+ <item>androidx.health.permission.RespiratoryRate.READ</item>
71
+ <item>androidx.health.permission.Weight.READ</item>
72
+ <item>androidx.health.permission.Height.READ</item>
73
+ <item>androidx.health.permission.BodyFat.READ</item>
74
+ <item>androidx.health.permission.LeanBodyMass.READ</item>
75
+ <item>androidx.health.permission.BodyWaterMass.READ</item>
76
+ <item>androidx.health.permission.BodyTemperature.READ</item>
77
+ <item>androidx.health.permission.BloodPressure.READ</item>
78
+ <item>androidx.health.permission.BoneMass.READ</item>
79
+ </array>
80
+ </resources>
81
+ ```
82
+
83
+ Then reference the permissions to your AndroidManifest.xml file in the activity that will call for health permissions.
84
+
85
+ ```xml
86
+ <meta-data
87
+ android:name="health_permissions"
88
+ android:resource="@array/health_permissions" />
89
+ ```
90
+
91
+ As well as that you have to add intent filter to your activity definition so that you can request the permissions at runtime.
92
+
93
+ ```xml
94
+ <intent-filter>
95
+ <action android:name="androidx.health.ACTION_SHOW_PERMISSIONS_RATIONALE" />
96
+ </intent-filter>
97
+ ```
98
+
46
99
  ## Installation
47
100
 
48
101
  Install the react-native-spike-sdk package from [npm](https://www.npmjs.com/package/react-native-spike-sdk)
@@ -259,33 +312,43 @@ const conn = Spike.createConnection(
259
312
 
260
313
  ### SpikeConnection
261
314
 
262
- | Class | Method | Description |
263
- | --------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
264
- | SpikeConnection | getAppId | Retrieves the unique Spike application identifier.**Returns**: string |
265
- | SpikeConnection | getSpikeEndUserId | Retrieves the unique identifier assigned to the end-user by Spike.**Returns**: string |
266
- | SpikeConnection | getCustomerEndUserId | Retrieves the unique identifier assigned to the end-user by the customer.**Returns**: string |
267
- | 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 _SpikeConnectionIsClosed_ exception. |
268
- | SpikeConnection | extractData | Extracts local device data for the current date in the end-user’s time zone.**Parameters**: dataType(SpikeDataType)**Returns**: An instance of SpikeData. The concrete type will depend on the data type requested. |
269
- | SpikeConnection | extractDataInRange | Extracts local device data for the given time range. \***\*The maximum allowed single-query time interval is 7 days. If required, data of any longer time period can be accessed by iterating multiple queries of 7 days.\*\*\*\***Parameters**: dataType(SpikeDataType), from(DateTime), to(DateTime)**Returns\*\*: An instance of SpikeData. The concrete type will depend on the data type requested. |
270
- | SpikeConnection | pack | Creates a string representation of the connection state. This method facilitates the persistence of connections.**Returns**: String |
315
+ | Class | Method | Description | iOS | Android |
316
+ |-----------------|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|---------|
317
+ | SpikeConnection | getAppId | Retrieves the unique Spike application identifier.**Returns**: string | yes | yes |
318
+ | SpikeConnection | getSpikeEndUserId | Retrieves the unique identifier assigned to the end-user by Spike.**Returns**: string | yes | yes |
319
+ | SpikeConnection | getCustomerEndUserId | Retrieves the unique identifier assigned to the end-user by the customer.**Returns**: string | yes | yes |
320
+ | 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 _SpikeConnectionIsClosed_ exception. | yes | yes |
321
+ | SpikeConnection | extractData | Extracts local device data for the current date in the end-user’s time zone.**Parameters**: dataType(SpikeDataType)**Returns**: An instance of SpikeData. The concrete type will depend on the data type requested. | yes | yes |
322
+ | SpikeConnection | extractDataInRange | Extracts local device data for the given time range. \***\*The maximum allowed single-query time interval is 7 days. If required, data of any longer time period can be accessed by iterating multiple queries of 7 days.\*\*\*\***Parameters**: dataType(SpikeDataType), from(DateTime), to(DateTime)**Returns\*\*: An instance of SpikeData. The concrete type will depend on the data type requested. | yes | yes |
323
+ | SpikeConnection | pack | Creates a string representation of the connection state. This method facilitates the persistence of connections.**Returns**: String | yes | yes |
324
+ | 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 |
325
+ | SpikeConnection | checkPermissionsGranted | Initiates a check on whether all health permissions have been granted to ensure proper functioning of the SDK | no | yes |
326
+ | SpikeConnection | getHealthConnectAvailability | Provides information on whether HealthConnect is available on the device. | no | yes |
327
+ | SpikeConnection | revokeAllPermissions | Revokes all granted health permissions for the application. | no | yes |
328
+ | SpikeConnection | requestHealthPermissions | Requests all the supported health read permissions from HealthConnect. | no | yes |
271
329
 
272
330
  ### SpikeWebhookConnection
273
331
 
274
- | Class | Method | Description |
275
- | ---------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
276
- | SpikeWebhookConnection | getAppId | Retrieves the unique Spike application identifier.**Returns**: string |
277
- | SpikeWebhookConnection | getSpikeEndUserId | Retrieves the unique identifier assigned to the end-user by Spike.**Returns**: string |
278
- | SpikeWebhookConnection | getCustomerEndUserId | Retrieves the unique identifier assigned to the end-user by the customer.**Returns**: string |
279
- | SpikeWebhookConnection | getCallbackUrl | Returns the URL that will receive webhook notifications. |
280
- | SpikeWebhookConnection | 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 _SpikeConnectionIsClosed_ exception. |
281
- | SpikeWebhookConnection | extractData | Extracts local device data for the current date in the end-user’s time zone.**Parameters**: dataType(SpikeDataType)**Returns**: An instance of SpikeData. The concrete type will depend on the data type requested. |
282
- | SpikeWebhookConnection | extractDataInRange | Extracts local device data for the given time range. \***\*The maximum allowed single-query time interval is 7 days. If required, data of any longer time period can be accessed by iterating multiple queries of 7 days.\*\*\*\***Parameters**: dataType(SpikeDataType), from(DateTime), to(DateTime)**Returns\*\*: An instance of SpikeData. The concrete type will depend on the data type requested. |
283
- | SpikeWebhookConnection | 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.**Parameters**: dataType(SpikeDataType) |
284
- | SpikeWebhookConnection | extractAndPostDataInRange | Extracts local device data for the given time range and sends it as a webhook notification to the customer’s backend.**Parameters**: dataType(SpikeDataType), from(DateTime), to(DateTime) |
285
- | SpikeWebhookConnection | enableBackgroundDelivery&#xA; | Enables background data delivery for selected data types. No-op on Android (for now).**Parameters**: dataType(SpikeDataType) |
286
- | SpikeWebhookConnection | getBackgroundDeliveryDataTypes | Gets the data types for which background delivery is enabled. If background delivery is not enabled, an empty set is returned.**Returns**: Returns: A collection (a set) of SpikeDataType objects. |
287
- | SpikeWebhookConnection | pack | Creates a string representation of the connection state. This method facilitates the persistence of connections.**Returns**: String |
288
- | SpikeWebhookConnection | setListener | Sets a listener that is to handle notifications from the background delivery process.**Parameters: **listener(SpikeWebhookConnectionListener)\* If listener is not null, then any existing listener is replaced |
332
+ | Class | Method | Description | iOS | Android |
333
+ | ---------------------- |--------------------------------| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |------|---------|
334
+ | SpikeWebhookConnection | getAppId | Retrieves the unique Spike application identifier.**Returns**: string | yes | yes |
335
+ | SpikeWebhookConnection | getSpikeEndUserId | Retrieves the unique identifier assigned to the end-user by Spike.**Returns**: string | yes | yes |
336
+ | SpikeWebhookConnection | getCustomerEndUserId | Retrieves the unique identifier assigned to the end-user by the customer.**Returns**: string | yes | yes |
337
+ | SpikeWebhookConnection | getCallbackUrl | Returns the URL that will receive webhook notifications. | yes | yes |
338
+ | SpikeWebhookConnection | 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 _SpikeConnectionIsClosed_ exception. | yes | yes |
339
+ | SpikeWebhookConnection | extractData | Extracts local device data for the current date in the end-user’s time zone.**Parameters**: dataType(SpikeDataType)**Returns**: An instance of SpikeData. The concrete type will depend on the data type requested. | yes | yes |
340
+ | SpikeWebhookConnection | extractDataInRange | Extracts local device data for the given time range. \***\*The maximum allowed single-query time interval is 7 days. If required, data of any longer time period can be accessed by iterating multiple queries of 7 days.\*\*\*\***Parameters**: dataType(SpikeDataType), from(DateTime), to(DateTime)**Returns\*\*: An instance of SpikeData. The concrete type will depend on the data type requested. | yes | yes |
341
+ | SpikeWebhookConnection | 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.**Parameters**: dataType(SpikeDataType) | yes | yes |
342
+ | SpikeWebhookConnection | extractAndPostDataInRange | Extracts local device data for the given time range and sends it as a webhook notification to the customer’s backend.**Parameters**: dataType(SpikeDataType), from(DateTime), to(DateTime) | yes | yes |
343
+ | SpikeWebhookConnection | enableBackgroundDelivery&#xA; | Enables background data delivery for selected data types. No-op on Android (for now).**Parameters**: dataType(SpikeDataType) | yes | no |
344
+ | SpikeWebhookConnection | getBackgroundDeliveryDataTypes | Gets the data types for which background delivery is enabled. If background delivery is not enabled, an empty set is returned.**Returns**: Returns: A collection (a set) of SpikeDataType objects. | yes | no |
345
+ | SpikeWebhookConnection | pack | Creates a string representation of the connection state. This method facilitates the persistence of connections.**Returns**: String | yes | no |
346
+ | SpikeWebhookConnection | setListener | Sets a listener that is to handle notifications from the background delivery process.**Parameters: **listener(SpikeWebhookConnectionListener)\* If listener is not null, then any existing listener is replaced | yes | no |
347
+ | SpikeWebhookConnection | 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 |
348
+ | SpikeWebhookConnection | checkPermissionsGranted | Initiates a check on whether all health permissions have been granted to ensure proper functioning of the SDK | no | yes |
349
+ | SpikeWebhookConnection | getHealthConnectAvailability | Provides information on whether HealthConnect is available on the device. | no | yes |
350
+ | SpikeWebhookConnection | revokeAllPermissions | Revokes all granted health permissions for the application. | no | yes |
351
+ | SpikeWebhookConnection | requestHealthPermissions | Requests all the supported health read permissions from HealthConnect. | no | yes |
289
352
 
290
353
  - If listener is null, then any existing listener is removed |
291
354
 
@@ -293,9 +356,9 @@ const conn = Spike.createConnection(
293
356
 
294
357
  Abstract class allowing to receive notifications from the background data delivery process.
295
358
 
296
- | Class | Method | Description |
297
- | ------------------------------ | --------------- | ------------------------------------------------------------------------------- |
298
- | SpikeWebhookConnectionListener | onBackgroundLog | Invoked on an asynchronous data submission failure.**Parameters**: log (String) |
359
+ | Class | Method | Description | iOS | Android |
360
+ | ------------------------------ | --------------- | ------------------------------------------------------------------------------- | --- |---------|
361
+ | SpikeWebhookConnectionListener | onBackgroundLog | Invoked on an asynchronous data submission failure.**Parameters**: log (String) | yes | no |
299
362
 
300
363
  # Errors and Exceptions
301
364
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-spike-sdk",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Spike API for health and productivity data from wearables and IoT devices",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -5,7 +5,7 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
5
5
 
6
6
  Pod::Spec.new do |s|
7
7
  s.name = "react-native-spike-sdk"
8
- s.version = "1.0.21"
8
+ s.version = "1.0.22"
9
9
  s.summary = "Spike API for health and productivity data from wearables and IoT devices"
10
10
 
11
11
  s.description = <<-DESC
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
25
25
  s.swift_version = "5"
26
26
 
27
27
  s.dependency "React-Core"
28
- s.dependency "SpikeSDK", "1.0.22"
28
+ s.dependency "SpikeSDK", "1.0.23"
29
29
 
30
30
  # Don't install the dependencies when we run `pod install` in the old architecture.
31
31
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then