Git Product home page Git Product logo

fitkit's People

Contributors

allenwyma avatar indigothm avatar krokyze avatar ramonsan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fitkit's Issues

How to use this plugin in android

I really don't know how to make it work in android. I do enable the Fitness API and also obtain an OAuth 2.0 client ID. But the ID is nowhere to use. There is a prompt for which Google account to use, but then just silent disappear, then no error, await FitKit.requestPermissions(DataType.values) just return false.

Users are able to get past the google read activity prompt

Hi @krokyze,

I use in my app FitKit.requestPermissions([DataType.DISTANCE]) but if a user taps outside of the google prompt, I can never trigger it back and sometimes I get:
PlatformException(FitKit, 4: The user must be signed in to make this API call., null)

Is there any way I can re-trigger the google prompt?

Thanks.

New datatypes in v1.1.1 have broken compatibility w/ older versions of iOS

The addition of "STAND_TIME" appears to have made this package incompatible with iOS 12.4 (presumably other older iOS versions also).

FitKit.requestPermissions(DataType.values) always throws the following error:
PlatformException(FitKit, Error type "stand time" is not supported, null)

Removing "STAND_TIME" from fit_kit.dart solves the problem.
Oddly, "EXERCISE_TIME" doesn't generate an error.

Running example app is extremely difficult

As someone who is new to using google fit in flutter it is particularly hard to run the example app. A lot is either missing or just wrong such as the dependency of fit_kit in pubspec.yaml

Could there be some more instructions added to the README.md on how to make the example run? Thanks!

@krokyze If you need help feel free to let us know so we can submit a PR

problem using fitkit android

Hey i try the example and it don't work and try in project where i work and do OAuth 2.0 client ID and enable google fit api into the mail
and get error
Unhandled Exception: PlatformException(FitKit, User denied permission access, null, null)
i select my email then it get this error

Request of GoogleSignIn.hasPermissions

I hope support to hasPermissions API.

GoogleSignIn.hasPermissions(GoogleSignIn.getLastSignedInAccount(this), fitnessOptions)

How to use.

final hasPermissions = await FitKit.hasPermissions();
if (hasPermissions) {
  // read.
} else {
  // requestPermissions 
}

Steps not match with Google fit app

I Will try to get steps on my app
but steps did not match with google fit in android
code void healthDatareadAll() async {
steps=0;
if (await FitKit.requestPermissions(DataType.values)) {
for (DataType type in DataType.values) {
final results = await FitKit.read(
type,
DateTime(DateTime.now().year,DateTime.now().month,DateTime.now().day-1,0,0,0,0,0,),
DateTime.now().subtract(Duration(days: 1)),
);
if (type == DataType.STEP_COUNT) {
var stepsMap= results.asMap();
for( int i=0;i<stepsMap.length;i++) {
steps=steps+stepsMap[i].value;
}
Fluttertoast.showToast(
msg: steps.toString(),
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIos: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0);
}
}
}

How to use this plugin.

Hello!,

I have setup the plugin & at the launch of the app, readAll() is being called. I am selecting an google account & then User declined permission text appears. That's all. How to overcome this, please?

Crash on iOS

Hello. I'm using:

Future<void> fit() async {
  List<DataType> dataTypes = [DataType.STEP_COUNT, DataType.ENERGY];
  if (await FitKit.requestPermissions(dataTypes)) {
    for (DataType type in dataTypes) {
      final results = await FitKit.read(
        type,
        dateFrom: Jiffy().subtract(days: 1),
        dateTo: DateTime.now(),
      );
    }
  }
}

and it crashes for iOS right in await FitKit.requestPermissions(dataTypes)

The log I have from the simulator is:

2020-01-25 19:03:03.857700+0100 Runner[71026:823677] -[__NSCFBoolean hk_isValidPurposeString]: unrecognized selector sent to instance 0x7fff8061ea08
2020-01-25 19:03:03.877971+0100 Runner[71026:823677] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean hk_isValidPurposeString]: unrecognized selector sent to instance 0x7fff8061ea08'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff23c75c4c forwarding + 1436
4 CoreFoundation 0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
5 HealthKit 0x00007fff25aa522e -[HKHealthStore _validateHealthDataPurposeStringsForSharingTypes:readingTypes:isResearchStudy:] + 885
6 HealthKit 0x00007fff25aa4bd7 -[HKHealthStore _validatePurposeStringsForSharingTypes:readingTypes:] + 384
7 HealthKit 0x00007fff25aa43c2 -[HKHealthStore requestAuthorizationToShareTypes:readTypes:shouldPrompt:completion:] + 354
8 HealthKit 0x00007fff25aa412e -[HKHealthStore requestAuthorizationToShareTypes:readTypes:completion:] + 77
9 fit_kit 0x0000000110ca82b4 $s7fit_kit17SwiftFitKitPluginC20requestAuthorization33_B5B63DA1CEDF30F36A7BBB05B461F1D3LL11sampleTypes10completionySaySo12HKSampleTypeCG_ySb_So12FlutterErrorCSgtctF + 756
10 fit_kit 0x0000000110ca79e2 $s7fit_kit17SwiftFitKitPluginC18requestPermissions33_B5B63DA1CEDF30F36A7BBB05B461F1D3LL0G06resultyAA0H7RequestC_yypSgctF + 146
11 fit_kit 0x0000000110ca5e12 $s7fit_kit17SwiftFitKitPluginC6handle_6resultySo17FlutterMethodCallC_yypSgctF + 1154
12 fit_kit 0x0000000110ca694b $s7fit_kit17SwiftFitKitPluginC6handle_6resultySo17FlutterMethodCallC_yypSgctFTo + 139
13 Flutter 0x000000010ec2533b __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
14 Flutter 0x000000010ebb6130 _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 166
15 Flutter 0x000000010ebb9bde _ZN7flutter15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 38
16 Flutter 0x000000010ec1e64d _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_32NS_9allocatorIS8_EEFvvEEclEv + 57
17 Flutter 0x000000010ebc9cd7 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 117
18 Flutter 0x000000010ebcea1c ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0 + 26
19 CoreFoundation 0x00007fff23bd4b94 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20
20 CoreFoundation 0x00007fff23bd4882 __CFRunLoopDoTimer + 1026
21 CoreFoundation 0x00007fff23bd3eda __CFRunLoopDoTimers + 266
22 CoreFoundation 0x00007fff23bcec4e __CFRunLoopRun + 2238
23 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
24 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
25 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
26 Runner 0x000000010e8730c8 main + 72
27 libdyld.dylib 0x00007fff5227ec25 start + 1
28 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

and this is the crash from a device:

2020-01-25 19:09:48.345991+0100 Runner[392:12243] -[__NSCFBoolean hk_isValidPurposeString]: unrecognized selector sent to instance 0x1d1d655d0
2020-01-25 19:09:48.346631+0100 Runner[392:12243] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean hk_isValidPurposeString]: unrecognized selector sent to instance 0x1d1d655d0'
*** First throw call stack:
(0x19568b278 0x1953b40a4 0x19558ef94 0x19568f5d8 0x19569110c 0x1a85fe83c 0x1a85fe2b8 0x1a85fdadc 0x1a85fd828 0x100a76540 0x100a75c30 0x100a74108 0x100a74ae4 0x100e677c8 0x100dfdc48 0x100e58324 0x100e0e71c 0x100e10a28 0x1956096cc 0x195609408 0x195608ad8 0x195603c14 0x19560316c 0x19f43b328 0x19966dd0c 0x1009c8cd8 0x19548e424)
libc++abi.dylib: terminating with uncaught exception of type NSException

I'm using an automatic signed certificate and HealthKit is "enabled":

image

How to use this?

I have added your library, in Android, it only show me which account to use but not asking for permission?

App crush and Exited

I can't run the example app ... App stop execution and print this message:

`Launching lib/main.dart on iPhone X in debug mode...
Xcode build done.                                           34.1s
    HKQuantityTypeIdentifierBodyMass,
    HKQuantityTypeIdentifierActiveEnergyBurned,
    HKQuantityTypeIdentifierStepCount,
    HKQuantityTypeIdentifierHeartRate,
    HKQuantityTypeIdentifierDistanceWalkingRunning,
    HKQuantityTypeIdentifierDietaryWater,
    HKQuantityTypeIdentifierHeight
)
Lost connection to device.
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001080421bb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x00000001075e0735 objc_exception_throw + 48
	2   CoreFoundation                      0x0000000108042015 +[NSException raise:format:] + 197
	3   HealthKit                           0x0000000106c26921 -[HKHealthStore _validateHealthDataPurposeStringsForSharingTypes:readingTypes:] + 785
	4   HealthKit                           0x0000000106c2642b -[HKHealthStore _validatePurp<…>
Exited (sigterm)`

Android 10 - ACTIVITY_RECOGNITION

Hi!

On Android 10 getting PlatformException

I/flutter (11492): PlatformException(FitKit, 10: SecurityException: com.google.step_count.delta requires android.permission.ACTIVITY_RECOGNITION, null) I/flutter (11492): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569) I/flutter (11492): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156) I/flutter (11492): <asynchronous suspension> I/flutter (11492): #2 MethodChannel.invokeListMethod (package:flutter/src/services/platform_channel.dart:342) I/flutter (11492): <asynchronous suspension> I/flutter (11492): #3 FitKit.read.<anonymous closure> (package:fit_kit/src/fit_kit.dart:0) I/flutter (11492): <asynchronous suspension>

How to fix it?

Missing Fitness Access popup

Hi I have used your widget in other apps, but this particular app using the newest widget is not popping up the authorization screen, I am only seeing the account selection.

Example: PlatformException

Hi, I am new to Flutter and Google Fit integration. I tried following the example provided and I am seeing
Result: realdAll: PlatformException(FitKit, type stand_time is not supported, null)

Can someone help me with this?

Unable to fetch SLEEP data

I am trying to fetch sleep data on iOS 13+ device without success - I am receiving empty list regardless date range being used.

final sleepCount = await FitKit.read(
DataType.SLEEP,
dateFrom: _startDate,
dateTo: _endDate,
);

Permissions are granted upon first run. It does work for DataType.STEP_COUNT

requestCode too big.

FitKit/android/src/main/kotlin/com/example/fit_kit/FitKitPlugin.kt

45 | private const val GOOGLE_FIT_REQUEST_CODE = 80085

Did I miss something or is there a way to set it up differently?

weight and height empty

Hi,

Thanks for the plugin, it's awesome.

I tested it both with Android and iOS builds and works fine but I can't get any value for Height and Weight. I have it both in Apple Health and Google Fit and I'm reading it with the readAll method. Is this supposed to work? As they are not values within a period of time maybe I need to do it with read only?

Kotlin version issue

What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
project ':fit_kit' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

[Bug] FitKit iOS will ignore data in the same hour.

Hey,

I think I may have hit a bug.

How to reproduce:
1- create 3 walking/running/distance activities in a span of an hour. Let's say 11/11/2019 11:00:00PM to 12:00:00PM
2- The first activity will have a start date 11/11/2019 11:00:00PM UTC end date 11/11/2019 11:15:00PM UTC
3- The second activity will have a start date 11/11/2019 11:16:00PM UTC end date 11/11/2019 11:32:00PM UTC
4- The third activity will have a start date 11/11/2019 11:40:00PM UTC end date 11/11/2019 11:50:00PM UTC
5- Query using FitKit.read(DataType.DISTANCE, dateFrom: DateTime.parse("11/11/2019 11:39:00"), dateTo: DateTime.now().toUtc());
6- See how the query returns 0 results.

Any help would be much much appreciated. Thanks.

Authentication Failure

Hi we are running your newest widget and are having issues with Android, it is not showing permission screen and is going directly to the account selection and then it fails. IOS is working perfectly.

[iOS] HeathKit - background delivery

Is it possible with the plugin to get data even when app is in background.
This feature is required for my use case.
It seems possible as describe in this post:
[https://stackoverflow.com/questions/26375767/healthkit-background-delivery-when-app-is-not-running]

How to read user details?

I am trying to display the Fitness Datatypes with the user's name and email. How do I get the logged-in user's details?

Must specify a valid bucketing strategy while requesting aggregation

Thanks for writing this plugin.

I encounter Platform exception when trying to fetch steps data with this code :

final start = startOfDay(date);
final end = endOfDay(date);
final data = await FitKit.read(DataType.STEP_COUNT, start, end);

The exception

 PlatformException(FitKit, Must specify a valid bucketing strategy while requesting aggregation, null)

Tried solution from here, by removing bucketByTime(...), no exception thrown, but results always empty or 0.

Is this a problem with the data aggregation? Thanks in advance.

disconnect fit kit

After connect to healthkit can i have anyway to disconnect and reconnect again?

how to get current permission status

I need to get current status at Fitness
because need activate permission request button when permission canceled from outside .
so, how can I get that?

Duplicates the AppleWatch and devices data on iOS

The apple health stores the energy, steps, and distance data.

The apple health shows, that my Watch stored 12500 steps, and the device tracked 12200. But fit_kit cumulates the data, and I get a result of 24700. Can we make difference somehow among the data sources?

Got the permission, but every array is empty, when it reads the data.

Thank you for this awesome pub!
I implemented it, and everything works fine in iOS, but somehow android device give me empty arrays, without any data.
If I am right, I got the permission, and the console printing me every datatype, but it has an empty square bracket.
Should I do any specific on android devices?
My application not appears in the device setting at the Samsung Health Settings -> connected services (where my fitness apps are - that apps also using the samsung health data too).

`fit_kit` does not specify a Swift version

I get the following error when running the example code:

fit_kit does not specify a Swift version and none of the targets (Runner) integrating it have the SWIFT_VERSION attribute set. Please contact the author or set the SWIFT_VERSION attribute in at least one of the targets that integrate this pod.

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.