-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
M3-107 Feat : 안드로이드 신체활동 권한, 안드로이드 걷기 인터페이스 일부 구현
- Loading branch information
Showing
5 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:get/get.dart'; | ||
import 'package:pedometer/pedometer.dart'; | ||
|
||
import '../utils/walking_service.dart'; | ||
|
||
class AndroidWalkInterface extends GetxController implements WalkingService{ | ||
late Stream<StepCount> _stepCountStream; | ||
|
||
@override | ||
RxInt step = 0.obs; | ||
|
||
RxInt get steps => step; | ||
|
||
@override | ||
void getCurrentStep(StepCount event){ | ||
step.value = event.steps; | ||
} | ||
|
||
void onStepCountError(error) { | ||
//print('onStepCountError: $error'); | ||
step.value = 0; | ||
} | ||
|
||
void initPlatformState() { | ||
_stepCountStream = Pedometer.stepCountStream; | ||
_stepCountStream.listen(getCurrentStep).onError(onStepCountError); | ||
} | ||
|
||
@override | ||
List<int> getWeeklySteps(startDate, endDate){ | ||
List<int> a = []; | ||
return a; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import 'package:get/get.dart'; | ||
import 'package:pedometer/pedometer.dart'; | ||
|
||
abstract class WalkingService { | ||
late int step; | ||
late RxInt step; | ||
|
||
int getCurrentStep(); | ||
void getCurrentStep(StepCount event); | ||
|
||
List<int> getWeeklySteps(startDate, endDate); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters