Installation
The current version is 0.4.0. Tags have no v: 0.1.0, 0.2.0, 0.3.0, 0.4.0…
Add the package
Section titled “Add the package”In Xcode: File → Add Package Dependencies… and paste the repository URL. Or in your Package.swift:
dependencies: [ .package(url: "https://github.com/elmaedesistemas/torke-kit-ios", from: "0.4.0")],targets: [ .target(name: "MyApp", dependencies: [ .product(name: "TorkeKit", package: "torke-kit-ios"), .product(name: "TorkeKitSensors", package: "torke-kit-ios"), ])]| Product | What it has | Depends on |
|---|---|---|
TorkeKit |
The engine, RunSession, the torke.run format, RecordedRunProvider, DemoRun |
Foundation only (iOS 17, macOS 14) |
TorkeKitSensors |
PhoneSensorProvider (CoreMotion + CoreLocation), PhoneBarometer |
iOS |
TorkeKit is published on JitPack. Add the repository and the dependency:
dependencyResolutionManagement { repositories { google() mavenCentral() maven("https://jitpack.io") }}dependencies { implementation("com.github.elmaedesistemas.torke-kit-android:torke-kit-sensors:0.4.0") // Only the core, without Android (a server, tests): // implementation("com.github.elmaedesistemas.torke-kit-android:torke-kit:0.4.0")}| Module | What it has | Depends on |
|---|---|---|
torke-kit |
The engine, RunSession, the torke.run format, RecordedRunProvider, DemoRun |
Kotlin (JVM), coroutines, kotlinx.serialization |
torke-kit-sensors |
PhoneSensorProvider (SensorManager + LocationManager), PhoneBarometer |
Android, minSdk 26 |
torke-validate |
The validation command | Java 17 |
Ask for permissions
Section titled “Ask for permissions”-
Explain what you use the sensors for in
Info.plist:Info.plist <key>NSLocationWhenInUseUsageDescription</key><string>We use the GPS to measure the speed and distance of your runs.</string><key>NSMotionUsageDescription</key><string>We use the accelerometer to detect the launch and time the 60 feet.</string> -
Ask for permission before arming the run:
let phone = PhoneSensorProvider()await phone.requestPermission() -
Keep the screen on while recording:
UIApplication.shared.isIdleTimerDisabled = true
-
Declare the permission in
AndroidManifest.xml:AndroidManifest.xml <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> -
Ask for precise location before creating the provider:
val ask = rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->if (granted) phone = PhoneSensorProvider(context)}ask.launch(Manifest.permission.ACCESS_FINE_LOCATION) -
Keep the screen on while recording:
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)To record with the screen off, collect inside a foreground service of type
location.