react-native-step-tracker-pro 1.0.0
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/LICENSE +21 -0
- package/README.md +148 -0
- package/android/build.gradle +119 -0
- package/android/consumer-rules.pro +13 -0
- package/android/gradle.properties +3 -0
- package/android/src/main/AndroidManifest.xml +78 -0
- package/android/src/main/java/com/steptrackerpro/StepTrackerProModule.kt +598 -0
- package/android/src/main/java/com/steptrackerpro/StepTrackerProPackage.kt +26 -0
- package/android/src/main/java/com/steptrackerpro/core/DateKeys.kt +90 -0
- package/android/src/main/java/com/steptrackerpro/core/GoalTracker.kt +66 -0
- package/android/src/main/java/com/steptrackerpro/core/MetricsCalculator.kt +48 -0
- package/android/src/main/java/com/steptrackerpro/core/Models.kt +73 -0
- package/android/src/main/java/com/steptrackerpro/core/StepCounterEngine.kt +338 -0
- package/android/src/main/java/com/steptrackerpro/core/StepStateStore.kt +137 -0
- package/android/src/main/java/com/steptrackerpro/core/StepTrackerConfig.kt +184 -0
- package/android/src/main/java/com/steptrackerpro/core/StepTrackerCore.kt +280 -0
- package/android/src/main/java/com/steptrackerpro/db/Entities.kt +67 -0
- package/android/src/main/java/com/steptrackerpro/db/StepDao.kt +118 -0
- package/android/src/main/java/com/steptrackerpro/db/StepDatabase.kt +60 -0
- package/android/src/main/java/com/steptrackerpro/db/StepRepository.kt +146 -0
- package/android/src/main/java/com/steptrackerpro/health/HealthConnectManager.kt +198 -0
- package/android/src/main/java/com/steptrackerpro/health/HealthPermissionActivity.kt +99 -0
- package/android/src/main/java/com/steptrackerpro/service/BootReceiver.kt +54 -0
- package/android/src/main/java/com/steptrackerpro/service/NotificationActionReceiver.kt +17 -0
- package/android/src/main/java/com/steptrackerpro/service/NotificationFactory.kt +170 -0
- package/android/src/main/java/com/steptrackerpro/service/ServiceCommands.kt +42 -0
- package/android/src/main/java/com/steptrackerpro/service/StepTrackerService.kt +409 -0
- package/android/src/main/java/com/steptrackerpro/sync/SyncScheduler.kt +102 -0
- package/android/src/main/java/com/steptrackerpro/sync/SyncWorkers.kt +175 -0
- package/android/src/main/java/com/steptrackerpro/util/BatteryOptimizationHelper.kt +94 -0
- package/android/src/main/java/com/steptrackerpro/util/Bridge.kt +149 -0
- package/android/src/main/java/com/steptrackerpro/util/PermissionHelper.kt +92 -0
- package/android/src/main/java/com/steptrackerpro/util/StepEventBus.kt +53 -0
- package/android/src/main/res/drawable/stp_ic_steps.xml +9 -0
- package/android/src/main/res/values/strings.xml +9 -0
- package/android/src/main/res/values/styles.xml +8 -0
- package/android/src/newarch/java/com/steptrackerpro/StepTrackerProSpec.kt +10 -0
- package/android/src/oldarch/java/com/steptrackerpro/StepTrackerProSpec.kt +60 -0
- package/docs/API.md +329 -0
- package/docs/ARCHITECTURE.md +203 -0
- package/docs/INSTALLATION.md +175 -0
- package/docs/PLAY_STORE_COMPLIANCE.md +122 -0
- package/docs/TESTING.md +312 -0
- package/docs/TROUBLESHOOTING.md +96 -0
- package/lib/commonjs/NativeStepTrackerPro.js +14 -0
- package/lib/commonjs/NativeStepTrackerPro.js.map +1 -0
- package/lib/commonjs/StepTracker.js +290 -0
- package/lib/commonjs/StepTracker.js.map +1 -0
- package/lib/commonjs/constants.js +30 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/errors.js +24 -0
- package/lib/commonjs/errors.js.map +1 -0
- package/lib/commonjs/hooks/index.js +20 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useStepStats.js +51 -0
- package/lib/commonjs/hooks/useStepStats.js.map +1 -0
- package/lib/commonjs/hooks/useStepTracker.js +134 -0
- package/lib/commonjs/hooks/useStepTracker.js.map +1 -0
- package/lib/commonjs/index.js +64 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/NativeStepTrackerPro.js +12 -0
- package/lib/module/NativeStepTrackerPro.js.map +1 -0
- package/lib/module/StepTracker.js +284 -0
- package/lib/module/StepTracker.js.map +1 -0
- package/lib/module/constants.js +26 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/errors.js +18 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/hooks/index.js +5 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useStepStats.js +46 -0
- package/lib/module/hooks/useStepStats.js.map +1 -0
- package/lib/module/hooks/useStepTracker.js +129 -0
- package/lib/module/hooks/useStepTracker.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/NativeStepTrackerPro.d.ts +50 -0
- package/lib/typescript/NativeStepTrackerPro.d.ts.map +1 -0
- package/lib/typescript/StepTracker.d.ts +76 -0
- package/lib/typescript/StepTracker.d.ts.map +1 -0
- package/lib/typescript/constants.d.ts +10 -0
- package/lib/typescript/constants.d.ts.map +1 -0
- package/lib/typescript/errors.d.ts +8 -0
- package/lib/typescript/errors.d.ts.map +1 -0
- package/lib/typescript/hooks/index.d.ts +5 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useStepStats.d.ts +11 -0
- package/lib/typescript/hooks/useStepStats.d.ts.map +1 -0
- package/lib/typescript/hooks/useStepTracker.d.ts +26 -0
- package/lib/typescript/hooks/useStepTracker.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +183 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +79 -0
- package/src/NativeStepTrackerPro.ts +66 -0
- package/src/StepTracker.ts +410 -0
- package/src/constants.ts +43 -0
- package/src/errors.ts +31 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useStepStats.ts +55 -0
- package/src/hooks/useStepTracker.ts +167 -0
- package/src/index.ts +27 -0
- package/src/types.ts +203 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 react-native-step-tracker-pro contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# react-native-step-tracker-pro
|
|
2
|
+
|
|
3
|
+
Android step tracking for React Native that keeps counting when the app is
|
|
4
|
+
closed, the screen is locked, the process is killed, or the phone reboots.
|
|
5
|
+
Hardware sensor → foreground service → Room → Health Connect.
|
|
6
|
+
|
|
7
|
+
Android only. iOS has CMPedometer and a completely different permission model;
|
|
8
|
+
wrapping both behind one API produces a bad version of each.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import StepTracker from "react-native-step-tracker-pro";
|
|
12
|
+
|
|
13
|
+
await StepTracker.initialize({ height: 175, weight: 75, dailyGoal: 10000 });
|
|
14
|
+
await StepTracker.requestPermissions();
|
|
15
|
+
await StepTracker.startTracking();
|
|
16
|
+
|
|
17
|
+
StepTracker.addListener("stepsChanged", (data) => console.log(data.steps));
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## What it does
|
|
21
|
+
|
|
22
|
+
| | |
|
|
23
|
+
| -------------- | ----------------------------------------------------------------- |
|
|
24
|
+
| Sensor | `TYPE_STEP_COUNTER`, falling back to `TYPE_STEP_DETECTOR` |
|
|
25
|
+
| Background | Kotlin foreground service, `health` type, `START_STICKY` |
|
|
26
|
+
| Storage | Room — `step_history` + `daily_summary`, 31–35 day retention |
|
|
27
|
+
| Reboot | `BootReceiver` restarts the service and re-anchors the counter |
|
|
28
|
+
| Health Connect | read, write, historical read, idempotent sync |
|
|
29
|
+
| Offline | everything works with no network; remote sync is queued |
|
|
30
|
+
| Bridge | Turbo Module with an old-architecture shim, full TypeScript types |
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm install react-native-step-tracker-pro
|
|
36
|
+
cd android && ./gradlew clean
|
|
37
|
+
npx react-native run-android
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Requires `minSdk 26`, `compileSdk 35`, RN ≥ 0.74. Full steps, including the
|
|
41
|
+
Gradle overrides for Kotlin 2.x and the manifest entries your app has to add:
|
|
42
|
+
[docs/INSTALLATION.md](docs/INSTALLATION.md).
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
await StepTracker.initialize({
|
|
48
|
+
height: 175, // cm — drives stride length
|
|
49
|
+
weight: 75, // kg — drives calories
|
|
50
|
+
dailyGoal: 10000,
|
|
51
|
+
historyRetentionDays: 31, // how much history to keep on device
|
|
52
|
+
notificationTitle: "{steps} steps today",
|
|
53
|
+
healthConnectEnabled: true,
|
|
54
|
+
remoteSyncUrl: "https://api.example.com/steps", // optional
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Stride length defaults to `height × 0.415` (male) / `0.413` (female) /
|
|
59
|
+
`0.414` (unspecified); pass `strideLength` in metres to override. Calories use
|
|
60
|
+
`0.57 kcal × body mass (kg) × distance (km)`, adjustable via
|
|
61
|
+
`calorieCoefficient`. Both are estimates, and both match the order of magnitude
|
|
62
|
+
Google Fit and Samsung Health report — not their exact numbers, because neither
|
|
63
|
+
publishes its model.
|
|
64
|
+
|
|
65
|
+
## API
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
initialize(config) updateConfig(config) getConfig()
|
|
69
|
+
startTracking() pauseTracking() resumeTracking()
|
|
70
|
+
stopTracking() getTrackingState() isTracking()
|
|
71
|
+
|
|
72
|
+
getTodaySteps() getYesterdaySteps() getStepsForDate(date)
|
|
73
|
+
getWeeklyStats(options) getMonthlyStats(options) getYearlyStats(options)
|
|
74
|
+
getStatsForRange(from, to) getHistory(from, to)
|
|
75
|
+
|
|
76
|
+
requestPermissions() checkPermissions() getDeviceCapabilities()
|
|
77
|
+
isBatteryOptimizationEnabled() requestDisableBatteryOptimization()
|
|
78
|
+
|
|
79
|
+
getHealthConnectStatus() requestHealthConnectPermissions()
|
|
80
|
+
readHealthConnectSteps(a, b) writeHealthConnectSteps(date) syncWithHealthConnect()
|
|
81
|
+
|
|
82
|
+
syncNow() getPendingSyncCount()
|
|
83
|
+
resetToday() clearHistory() pruneHistory(days)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Events: `stepsChanged`, `goalReached`, `goalProgressChanged`,
|
|
87
|
+
`trackingStateChanged`, `dayChanged`, `syncCompleted`, `error`.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const sub = StepTracker.addListener("goalReached", ({ type, goal }) => {});
|
|
91
|
+
sub.remove();
|
|
92
|
+
// or
|
|
93
|
+
StepTracker.removeListener("goalReached");
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Signatures and payload shapes: [docs/API.md](docs/API.md).
|
|
97
|
+
|
|
98
|
+
## Hooks
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
const { snapshot, state, start, pause, requestPermissions } = useStepTracker({
|
|
102
|
+
dailyGoal: 10000,
|
|
103
|
+
autoStart: true,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const { stats } = useStepStats("week");
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## How the count survives things
|
|
110
|
+
|
|
111
|
+
`TYPE_STEP_COUNTER` reports steps since boot, so the day total is
|
|
112
|
+
`anchorSteps + (rawValue − anchorValue)`. The anchor is re-pinned on reboot, on
|
|
113
|
+
an OEM counter reset, and at midnight. Counter state lives in SharedPreferences
|
|
114
|
+
and is written on every sensor batch, so a process kill costs nothing — the
|
|
115
|
+
hardware kept counting while you were dead, and the next sample reconciles.
|
|
116
|
+
|
|
117
|
+
Details, including why steps between a reboot and the service restarting are
|
|
118
|
+
sometimes dropped on purpose: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
|
119
|
+
|
|
120
|
+
## Before you ship
|
|
121
|
+
|
|
122
|
+
Read [docs/PLAY_STORE_COMPLIANCE.md](docs/PLAY_STORE_COMPLIANCE.md). The three
|
|
123
|
+
things that get apps rejected here are the foreground service declaration, the
|
|
124
|
+
Health Connect permissions form, and asking for a battery optimisation
|
|
125
|
+
exemption without an eligible use case.
|
|
126
|
+
|
|
127
|
+
## Example app
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
cd example && npm install && npm run android
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Testing
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
cd android && ./gradlew :react-native-step-tracker-pro:connectedAndroidTest
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Eleven instrumented tests cover the reboot, midnight, pause and counter-reset
|
|
140
|
+
paths by feeding samples to the engine directly, so they run on an emulator with
|
|
141
|
+
no step hardware. The device-level QA matrix — force-stop recovery, real reboot,
|
|
142
|
+
Doze, Health Connect, OEM battery managers — is in
|
|
143
|
+
[docs/TESTING.md](docs/TESTING.md).
|
|
144
|
+
|
|
145
|
+
## Licence
|
|
146
|
+
|
|
147
|
+
MIT
|
|
148
|
+
# react-native-step-tracker-pro
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
// Consumers can override any of these in the app's root build.gradle:
|
|
3
|
+
// ext { kotlinVersion = "2.0.21"; kspVersion = "2.0.21-1.0.25"; roomVersion = "2.7.1" }
|
|
4
|
+
ext.stp_kotlinVersion = rootProject.ext.has("kotlinVersion")
|
|
5
|
+
? rootProject.ext.get("kotlinVersion") : "1.9.24"
|
|
6
|
+
ext.stp_kspVersion = rootProject.ext.has("kspVersion")
|
|
7
|
+
? rootProject.ext.get("kspVersion") : "1.9.24-1.0.20"
|
|
8
|
+
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
gradlePluginPortal()
|
|
13
|
+
}
|
|
14
|
+
dependencies {
|
|
15
|
+
classpath "com.android.tools.build:gradle:8.6.0"
|
|
16
|
+
// Bare references, not ${ext.…}: inside a nested dependencies{} block
|
|
17
|
+
// `ext` resolves to the buildscript's own extra properties, not the
|
|
18
|
+
// project's, so the ext-qualified form fails to resolve at all.
|
|
19
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$stp_kotlinVersion"
|
|
20
|
+
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$stp_kspVersion"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
def isNewArchitectureEnabled() {
|
|
25
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
apply plugin: "com.android.library"
|
|
29
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
30
|
+
apply plugin: "com.google.devtools.ksp"
|
|
31
|
+
if (isNewArchitectureEnabled()) {
|
|
32
|
+
apply plugin: "com.facebook.react"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
def safeExtGet(prop, fallback) {
|
|
36
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
def roomVersion = safeExtGet("roomVersion", "2.6.1")
|
|
40
|
+
// 1.1.0 stable requires compileSdk 36 and AGP 8.9.1+, which React Native did
|
|
41
|
+
// not ship until long after 0.76 - depending on it would silently break every
|
|
42
|
+
// consumer inside the react-native range peerDependencies claims to support.
|
|
43
|
+
// 1.1.0-beta01 is the newest release that still builds against compileSdk 35
|
|
44
|
+
// and carries the same Metadata API. Consumers on a newer toolchain can opt up
|
|
45
|
+
// with ext.healthConnectVersion.
|
|
46
|
+
def healthConnectVersion = safeExtGet("healthConnectVersion", "1.1.0-beta01")
|
|
47
|
+
def workVersion = safeExtGet("workVersion", "2.9.1")
|
|
48
|
+
|
|
49
|
+
android {
|
|
50
|
+
namespace "com.steptrackerpro"
|
|
51
|
+
compileSdk safeExtGet("compileSdkVersion", 35)
|
|
52
|
+
|
|
53
|
+
defaultConfig {
|
|
54
|
+
// 26 is the floor for java.time and for the Health Connect client.
|
|
55
|
+
minSdk safeExtGet("minSdkVersion", 26)
|
|
56
|
+
targetSdk safeExtGet("targetSdkVersion", 35)
|
|
57
|
+
consumerProguardFiles "consumer-rules.pro"
|
|
58
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
59
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
buildFeatures {
|
|
63
|
+
buildConfig true
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
compileOptions {
|
|
67
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
68
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
kotlinOptions {
|
|
72
|
+
jvmTarget = "17"
|
|
73
|
+
freeCompilerArgs += ["-Xjvm-default=all"]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
sourceSets {
|
|
77
|
+
main {
|
|
78
|
+
if (isNewArchitectureEnabled()) {
|
|
79
|
+
java.srcDirs += ["src/newarch/java", "${project.buildDir}/generated/source/codegen/java"]
|
|
80
|
+
} else {
|
|
81
|
+
java.srcDirs += ["src/oldarch/java"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
lint {
|
|
87
|
+
abortOnError false
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
ksp {
|
|
92
|
+
arg("room.schemaLocation", "$projectDir/schemas")
|
|
93
|
+
arg("room.incremental", "true")
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
repositories {
|
|
97
|
+
google()
|
|
98
|
+
mavenCentral()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
dependencies {
|
|
102
|
+
implementation "com.facebook.react:react-android"
|
|
103
|
+
|
|
104
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1"
|
|
105
|
+
implementation "androidx.core:core-ktx:1.13.1"
|
|
106
|
+
implementation "androidx.lifecycle:lifecycle-service:2.8.4"
|
|
107
|
+
implementation "androidx.activity:activity-ktx:1.9.2"
|
|
108
|
+
|
|
109
|
+
implementation "androidx.room:room-runtime:$roomVersion"
|
|
110
|
+
implementation "androidx.room:room-ktx:$roomVersion"
|
|
111
|
+
ksp "androidx.room:room-compiler:$roomVersion"
|
|
112
|
+
|
|
113
|
+
implementation "androidx.work:work-runtime-ktx:$workVersion"
|
|
114
|
+
implementation "androidx.health.connect:connect-client:$healthConnectVersion"
|
|
115
|
+
|
|
116
|
+
androidTestImplementation "androidx.test:core-ktx:1.6.1"
|
|
117
|
+
androidTestImplementation "androidx.test:runner:1.6.2"
|
|
118
|
+
androidTestImplementation "androidx.test.ext:junit:1.2.1"
|
|
119
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Room generated implementations are reflected on at runtime.
|
|
2
|
+
-keep class com.steptrackerpro.db.** { *; }
|
|
3
|
+
-keep class androidx.room.RoomDatabase { *; }
|
|
4
|
+
-dontwarn androidx.room.paging.**
|
|
5
|
+
|
|
6
|
+
# Health Connect record classes are resolved by name.
|
|
7
|
+
-keep class androidx.health.connect.client.records.** { *; }
|
|
8
|
+
-dontwarn androidx.health.connect.client.**
|
|
9
|
+
|
|
10
|
+
# Service, receiver and activity entry points referenced from the manifest.
|
|
11
|
+
-keep class com.steptrackerpro.service.** { *; }
|
|
12
|
+
-keep class com.steptrackerpro.health.HealthPermissionActivity { *; }
|
|
13
|
+
-keep class com.steptrackerpro.sync.** { *; }
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
3
|
+
|
|
4
|
+
<!-- Step sensors. Runtime permission from API 29. -->
|
|
5
|
+
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
|
|
6
|
+
<uses-permission
|
|
7
|
+
android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION"
|
|
8
|
+
android:maxSdkVersion="28" />
|
|
9
|
+
|
|
10
|
+
<!-- Foreground service. FOREGROUND_SERVICE_HEALTH is required from API 34. -->
|
|
11
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
12
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH" />
|
|
13
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
14
|
+
<!-- Used by WorkManager to hold the CPU awake while a sync job runs. -->
|
|
15
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
16
|
+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
17
|
+
|
|
18
|
+
<!--
|
|
19
|
+
Only needed if you call requestDisableBatteryOptimization(). Remove this
|
|
20
|
+
line and use openBatteryOptimizationSettings() instead if you do not have
|
|
21
|
+
an eligible Play Console use case. See docs/PLAY_STORE_COMPLIANCE.md.
|
|
22
|
+
-->
|
|
23
|
+
<uses-permission
|
|
24
|
+
android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"
|
|
25
|
+
tools:node="merge" />
|
|
26
|
+
|
|
27
|
+
<!-- Health Connect. Remove the pairs you do not use. -->
|
|
28
|
+
<uses-permission android:name="android.permission.health.READ_STEPS" />
|
|
29
|
+
<uses-permission android:name="android.permission.health.WRITE_STEPS" />
|
|
30
|
+
<uses-permission android:name="android.permission.health.READ_DISTANCE" />
|
|
31
|
+
<uses-permission android:name="android.permission.health.WRITE_DISTANCE" />
|
|
32
|
+
<uses-permission android:name="android.permission.health.READ_TOTAL_CALORIES_BURNED" />
|
|
33
|
+
<uses-permission android:name="android.permission.health.WRITE_TOTAL_CALORIES_BURNED" />
|
|
34
|
+
|
|
35
|
+
<uses-feature
|
|
36
|
+
android:name="android.hardware.sensor.stepcounter"
|
|
37
|
+
android:required="false" />
|
|
38
|
+
<uses-feature
|
|
39
|
+
android:name="android.hardware.sensor.stepdetector"
|
|
40
|
+
android:required="false" />
|
|
41
|
+
|
|
42
|
+
<queries>
|
|
43
|
+
<package android:name="com.google.android.apps.healthdata" />
|
|
44
|
+
</queries>
|
|
45
|
+
|
|
46
|
+
<application>
|
|
47
|
+
<service
|
|
48
|
+
android:name="com.steptrackerpro.service.StepTrackerService"
|
|
49
|
+
android:enabled="true"
|
|
50
|
+
android:exported="false"
|
|
51
|
+
android:foregroundServiceType="health"
|
|
52
|
+
android:stopWithTask="false" />
|
|
53
|
+
|
|
54
|
+
<receiver
|
|
55
|
+
android:name="com.steptrackerpro.service.BootReceiver"
|
|
56
|
+
android:enabled="true"
|
|
57
|
+
android:exported="true"
|
|
58
|
+
android:directBootAware="false">
|
|
59
|
+
<intent-filter android:priority="1000">
|
|
60
|
+
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
61
|
+
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
|
62
|
+
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
|
63
|
+
</intent-filter>
|
|
64
|
+
</receiver>
|
|
65
|
+
|
|
66
|
+
<receiver
|
|
67
|
+
android:name="com.steptrackerpro.service.NotificationActionReceiver"
|
|
68
|
+
android:enabled="true"
|
|
69
|
+
android:exported="false" />
|
|
70
|
+
|
|
71
|
+
<activity
|
|
72
|
+
android:name="com.steptrackerpro.health.HealthPermissionActivity"
|
|
73
|
+
android:exported="false"
|
|
74
|
+
android:excludeFromRecents="true"
|
|
75
|
+
android:launchMode="singleTop"
|
|
76
|
+
android:theme="@style/StepTrackerPro.Transparent" />
|
|
77
|
+
</application>
|
|
78
|
+
</manifest>
|