react-native-movesense
Getting started
yarn add react-native-movesense
then
cd ios && pod install
Additional steps
iOS
- Intall Movesense iOS library using CocoaPods by adding this line to your app's Podfile:
pod 'Movesense', :git => 'ssh://git@altssh.bitbucket.org:443/suunto/movesense-mobile-lib.git'
- Add 'libmds.a' from Movesense pod to your list of linked libraries. You may need to also add library search path for it.
Android
-
Download 'mdslib-x.x.x-release.aar' from movesense-mobile-lib repository and put it somewhere under 'android' folder of your app. Preferably create a new folder named 'android/libs' and put it there. Minimum supported version is 1.6.0.
-
In 'build.gradle' of your android project, add the following lines (assuming .aar file is in android/libs):
allprojects {
repositories {
...
flatDir{
dirs "$rootDir/libs"
}
}
}
Troubleshoot
Android
- 'minSdkVersion' needs to be at least 18.
iOS
-
You may need to set "Swift Language Version" for Movesense Pod to 5.0. This setting can be found in "Build Settings" of Movesense pod in XCode project of your app.
-
If you get the following error while building your app:
ld: library not found for -lswiftSwiftOnoneSupport for architecture arm64
then you need to add library search path for that library. One of the common places is:
-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos
However, the correct answer may depend on XCode version.
- Movesense library doesn't have bitcode support at the moment. You need to disable it for your app as well.
Usage
; // Scan for bluetooth devicesmovesense; // Stop scanningmovesense; // Set handlersmovesense; // Connect to a device using addressmovesense; // Disconnect from a device using addressmovesense; // Get a resourceconst response = await movesense; // Put a resourceconst response = await movesense; // Post a resourceconst response = await movesense; // Del a resourceconst response = await movesense; // Subscribes to movesense notificationsmovesense; // Subscribe to a resourcevar key = movesense; // Unsubscribe from a subsciptionmovesense; // Remove native event handlers (generally called once you're done with everything - i.e. no longer subscribed to events)movesense;