如何使用Google flutter?

发布于 2025-02-08 17:06:58 字数 142 浏览 2 评论 0原文

我试图在扑朔迷离中实现健康软件包,但我发现代码很难理解,因为我是初学者,也找不到任何视频。

我要做的就是显示我的应用程序中的步骤数,这些步骤将从Google Fit/Apple Health中获取,以获取有关如何执行此操作的任何提示。

谢谢。

Im trying to implement the health package in flutter but I'm finding the code for it a bit difficult to understand as I'm a beginner and can't find any videos on it either.

All I want to do is display the number of steps in my app which will be taken from google fit/apple health, up for any tips on how to do the same.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不即不离 2025-02-15 17:06:59

我也是一个初学者,我本人一直很难找到过去2-3个月使用健康软件包的解决方案。我可能找到了解决方案,我将尝试提供关键点,并解释它们如何成功使用Android设备上的软件包(我尚未在iOS设备上测试包装)。

P/S:这是我在Github上的第一个评论。

步骤1:在Google Cloud Platform上创建项目( https://developers.google.com/适合/android/启动)。您将需要flutter Project中的SHA-1指纹和包装名称(据我了解,这就是您的应用程序与Google API进行通信的方式)。只需按照提供的步骤,直到获得OAuth 2.0客户端ID。

步骤2:在测试用户上添加您的电子邮件。输入您想从Fit应用程序中读取数据的电子邮件。您将需要安装设备上的适合应用程序。该电子邮件必须与Fit应用中使用的电子邮件相同。您必须手动执行此步骤,因为您的应用程序仍处于测试模式。您将需要使用Google验证您的应用程序,以自动保存用户电子邮件。

步骤3:我们将使用这个项目,由Madsvschristensen 。我们无法使用MADSVSCHRISTENSEN的整个应用程序,因为SHA-1指纹和包装名称与我们自己的Flutter应用程序不同。因此,我们只需要将其代码复制到我们的项目中即可。您可以在“狂图”应用程序上创建新页面以显示MADSVSCHRISTENSEN项目(这只是一个假人,如果您不了解Madsvschristensen的代码,则可以。我们的目标是将fitch apps从fit apps中获取到我们的flutter应用程序中。您可以尝试阅读和理解整个代码)。

步骤4:许可!如健康软件包,您将需要在设备上启用扑朔迷离的应用程序。您可以尝试使用crermission_handler,也可以手动启用Android设备上的权限。

步骤5:测试您在物理设备上的扑动项目。不知何故,我无法从模拟器设备上从Google Fit应用程序中获取数据。

希望这会有所帮助。

I'm a beginner too and I myself have been struggle to find the solution on how to use the Health package for the past 2-3 month. I may have find the solution, I will try to provide key points and explain them on how I succeed to use the package on Android devices (I have not tested the package on iOS devices).

P/s: This is my first comment ever on GitHub.

STEP 1: Create project on Google Cloud Platform (https://developers.google.com/fit/android/get-started). You are going to need SHA-1 fingerprint and package name from your Flutter project (From my understanding, this is how your apps communicate with Google APIs). Just follow the steps provided until you obtain an OAuth 2.0 client ID.

STEP 2: Add your Emails on Test Users. Enter an email you would like to read data from Fit Apps. You will need Fit apps installed on your device. The email must be the same as the email used in Fit apps. You have to do this step manually because your apps is still in test mode. You are going to need to verify your apps with Google in order to automatically save users email.

STEP 3: We are going to use the code from this project made by MadsVSChristensen. We cannot use the whole application from MadsVSChristensen because the SHA-1 fingerprint and package name are different from our own Flutter apps. Therefore, we are only need to copy their codes into our project. You can create new page on your Flutter apps to display MadsVSChristensen project (This is just a dummy and it is okay if you don't understand MadsVSChristensen's code. Our objective is to fetch data from Fit apps into our Flutter apps. After you succeed, you can try to read and understand the whole code).

STEP 4: PERMISSION! As stated in Health package, you will need to enable permission for your Flutter apps on the devices. You can try to use permission_handler or you can manually enable the permission on your Android devices.

STEP 5: Test your Flutter project on physical devices. Somehow I can't fetch data from Google Fit apps on emulator devices.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文