Skip to content

Commit

Permalink
Merge pull request #3 from GwonHyeok/main
Browse files Browse the repository at this point in the history
Fix app crash caused by duplicate calls to result.error() in Android environment. Solves issue: #4
  • Loading branch information
Flucadetena authored Jul 10, 2024
2 parents 3dee6bd + 3540da1 commit b071e14
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions android/src/main/kotlin/com/example/pedometer_2/ReadSteps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ fun getSteps(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding, startTime
if (hasMinPlayServices != ConnectionResult.SUCCESS) {
// Prompt user to update their device's Google Play services app and return
result.error("2", "Min playService version error", "${LocalRecordingClient.LOCAL_RECORDING_CLIENT_MIN_VERSION_CODE} is required, but found a lower version")
return
}

Log.d(TAG, "ActivityCompat: ${ActivityCompat.checkSelfPermission(context, Manifest.permission.ACTIVITY_RECOGNITION)}")
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACTIVITY_RECOGNITION) != PackageManager.PERMISSION_GRANTED) {
result.error("2", "Permissions have not been requested", Exception())
return
}
Log.d(TAG, "localRecordingClient:")
localRecordingClient.subscribe(LocalDataType.TYPE_STEP_COUNT_DELTA)
Expand Down

0 comments on commit b071e14

Please sign in to comment.