spike_flutter_sdk 1.0.4 copy "spike_flutter_sdk: ^1.0.4" to clipboard
spike_flutter_sdk: ^1.0.4 copied to clipboard

Reads HealthKit data from iOS HealthKit, and syncs it with Spike backend.

Spike Flutter SDK (version 1.0.0) allows you to read the Apple HealthKit data. Then, it allows you to send the data to your backend chosen, and get the data returned which is processed by the backend. Also, you can enable background tasks you want. And finally, it is possible to enable event tracking to see if everything works as intended or just provide your own event tracking library.

Features #

  1. Read the Apple HealthKit data.
  2. Send this data to backend.
  3. Register periodic background tasks to send and read the data.
  4. Track various events of the package by utilizing shared preferences.

Getting started #

Setup everything like you would to with https://pub.dev/packages/health_kit_reporter . Then, use this library as shown in example below (or in the longer one).

Usage #

The examples below demonstrates how to use this package in various of cases.

Initialization #

First, you must get the correct credentials in order for this package to be usable.

const authToken = 'fa0b3803-6068-4ea7-9788-eccce210d30c';
const appId = 'ea9e03f5-be45-49fb-bf4c-47a88c184c3b';
const customerEndUserId = 'jasbdhasbfashfj';
const postbackURL = 'https://example.com/';
copied to clipboard

Creating connection #

Using the credentials received, you can create the connection. It is super trivial and just too easy to do.

final connection = await SpikeSDK.createConnection(
  appId: appId,
  authToken: authToken,
  customerEndUserId: customerEndUserId,
);
copied to clipboard

Creating WebHook connection #

Creating Web Hook connection is also super easy to create.

final webHookConnection = await SpikeSDK.createConnection(
  appId: appId,
  authToken: authToken,
  customerEndUserId: customerEndUserId,
  postbackURL: postbackURL,
);
copied to clipboard

Requesting permissions #

In order to use the connection properly, you must first ask for the permissions needed for your purposes. Let us assume you want to get heart data. For this, you must to ask for heart data permissions. See the example below about how easy it is to do so.

SpikeSDK.ensurePermissionsAreGranted([SpikeDataType.heart]);
copied to clipboard

Just one line of code, and you are requesting the permissions.

Using the connection #

Using both simple and Web Hook connections are very easy to use. See the example below.

final heartData = await connection.extractData(SpikeDataType.heart);
final heartJobDetails = await webHookConnection.extractAndPostData(SpikeDataType.heart);
copied to clipboard
5
likes
0
points
1.11k
downloads

Publisher

verified publisherspikeapi.com

Weekly Downloads

2024.10.07 - 2025.04.21

Reads HealthKit data from iOS HealthKit, and syncs it with Spike backend.

Homepage

License

unknown (license)

Dependencies

cryptography, flutter, get_it, hex, http, shared_preferences, update, uuid

More

Packages that depend on spike_flutter_sdk