Coder Social home page Coder Social logo

bardram / polar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rexios80/polar

0.0 0.0 0.0 14.65 MB

‎‎‎‎‎This is a Dart plugin wrapper for the Polar SDK on Android and iOS

Home Page: https://pub.dev/packages/polar

License: BSD 3-Clause "New" or "Revised" License

Shell 0.49% Ruby 3.28% Objective-C 0.97% Kotlin 14.97% Dart 52.13% Swift 28.16%

polar's Introduction

polar

Plugin wrapper for the Polar SDK

Note

This is an unofficial wrapper for the Polar SDK. For any questions regarding the underlying SDKs or Polar devices in general, please see the official repository.

Getting Started

Android

android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30" />

If you use BLUETOOTH_SCAN to determine location, remove android:usesPermissionFlags="neverForLocation"

If you use location services in your app, remove android:maxSdkVersion="30" from the location permission tags

iOS

Change the deployment target in Xcode to iOS 13+

Podfile:

platform :ios, '13.0'

Info.plist:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Used to connect to Polar devices</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Used to connect to Polar devices</string>
<key>UIBackgroundModes</key>
<array>
  <string>bluetooth-central</string>
</array>

Usage

import 'package:flutter/foundation.dart';
import 'package:polar/polar.dart';

const identifier = '1C709B20';
final polar = Polar();

void example() {
  polar.heartRateStream.listen((e) => debugPrint('Heart rate: ${e.data.hr}'));
  polar.streamingFeaturesReadyStream.listen((e) {
    if (e.features.contains(DeviceStreamingFeature.ecg)) {
      polar
          .startEcgStreaming(e.identifier)
          .listen((e) => debugPrint('ECG data: ${e.samples}'));
    }
  });
  polar.connectToDevice(identifier);
}

polar's People

Contributors

bardram avatar rexios80 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.