Problem
When I call GoogleFit.getDailyStepCountSamples() to retrieve steps, I receive a step count that significantly lower than that shown in the Google Fit app.
Dev Environment
MacOS Big Sur
React Native 0.63.3
Android Simulator - Nexus 5 API 19
Steps to Replicate
Set your step options and call the function. The code would look something like the following
const stepsOpt = {
startDate: '2021-09-15T00:00:00.000Z', // the start of the day in question
endDate: new Date().toISOString(), // you could also set this to the end of the day
bucketUnit: 'MINUTE',
bucketInterval: 1
}
const res = await GoogleFit.getDailyStepCountSamples(stepsOpt)
console.log(`\n\nMy step data is\n${JSON.stringify(res, null, 2)}\n\n`)
In the resulting log, observe data from any com.google.android.gms source. Look at the total steps, and the rawSteps.
Compare this with the total number of steps shown in the Google Fit app for the same day (Can be found by opening the Google Fit app -> Home -> Trends/Steps -> Day -> See source data)
What I Observe
There is a mismatch between both the total steps and the rawSteps
What I Expected
To see a match between the total steps
To see some matches in the rawStep data
Screenshot
On the left is a screenshot of log after running my code. The right is a screenshot of the raw data according to the Google Fit app.
In short, if it's a sync issue, there is nothing you can do about, you just have to wait.
If it's caused by data is only taken from local device storage.
Or parts of data in Google Fit app is from other apps, these two need to be investigated and reproduced.
https://developers.google.com/fit/faq#how_do_i_get_the_same_values_step_count_calories_distance_etc_as_the_google_fit_app
Related
I have a problem with my react native(expo) application on the google store, every time I try to push it I get this message from google:
click here
I tried everything, I filled in the requested forms on security and data types, and I also added in the config of my application that I read the contact information and that I also open the camera like this:
"permissions": [
"READ_CONTACTS",
"CAMERA"
],
I don't know what else to do, if someone has an idea, I don't understand what they want from me, plus I can't contact them...
This means your app is creating a new unique id using UUID for advertising or analytics.
Just goto PlayConsole -> Select App -> App Content -> Data Safety Option -> Select unique ID's and write the reason to use this.
Submit it for review and it might take 1-2 days to get reviewed and it will get resolved.
Here is the complete information for the Data Safety forum ->
https://support.google.com/googleplay/android-developer/answer/10787469?hl=en
I'm setting up a Pedometer app in React Native using Expo, testing the code on my real Samsung s10 device.
I am using the Expo Pedometer documentation
However, when I use the Pedometer.getStepCountAsync method, I get returned an error "Getting step count for date range is not supported on Android yet."
I am trying to make a pedometer app that reads users steps, and then puts them into some visuals for the user but I can't get the steps data.
My code is below: it reaches the error => line and returns the error mentioned above. :(
I've enabled the Fitness API in my Google Developer Console and am 99% sure I have the right credentials; as I have used the Google Login successfully in the same app.
const end = new Date();
const start = new Date();
start.setDate(end.getDate() - 1);
Pedometer.getStepCountAsync(start, end).then(
result => {
this.setState({ pastStepCount: result.steps });
},
error => {
this.setState({
pastStepCount: "Could not get stepCount: " + error
});
}
);
I guess the expected result is that I get the user's steps from the past day in the result but instead I get the error that it is not supported on android.
I did something nasty as a workaround but it worked I added expo 33 as a legacy npm dependency and use only the pedometer module from there because currently they didn't implemented the pedometer functionality on android on the new Expo unimodules
package.json
"expo": "^35.0.0",
"expo-legacy": "npm:expo#33.0.0",
And use it like this
import {Pedometer} from 'expo-legacy'
Surprisingly compiled and only increased 200kb the apk size
Yes, by using Core Motion (iOS) or Google Fit (Android) to get the user's step count.
Any Android phone running on a 4.4 (KitKat) operating system or later will connect with Google Fit.
Pedometer unable to query steps, documentation unclear/contradictory.
I'm developing an Android application that uses U.are.U 4500 fingerprint reader to identify users. I already have a backend server, that uses SQL Server, to store and register user data and now I need my app to be able to read the user fingerprint and verify if this fingerprint matches any of the fingerprints on the database. Does anyone know a SDK that is able to do this comparison?
I'm using asia.kanopi.fingerscan package to read the user fingerprint and I already have the scan working, now I only need to get this image and compare to the data on the SQL database. I saw a few answers here on StackOverflow telling me to use openCV library for Android, but none of them could give me any lead on how to do it.
I based my development on this tutorial: https://medium.com/touch4it/fingerprint-external-scanner-with-usb-database-sdk-64c3ec5ea82d, but unfortunately I couldn't find the SDK IDKit Fingerprint SDK Mobile anywhere.
How can I sucessufully match the image with the one stored on the database?
For those who are still looking for an answer to this problem. It's been a while since I actually implemented my solution and, when I did it, I added this line to my app gradle file:
com.github.lmone:SourceAFIS-Android:v3.4.0-fix3
But now I can't seem to find the github link anywhere. Maybe the repository got deleted. If someone find it, please send it to me so I can update my answer here.
Besides that, if you can still add the library to your Android project, the basic idea is to use a FingerprintMatcher to compare two FingerprintTemplate.
Example:
FingerprintTemplate probe = new FingerprintTemplate().dpi(500).create(digital_byte_array);
while (result.next()) {
byte[] imgCandidate = digital_to_compare;
FingerprintTemplate candidate = new FingerprintTemplate()
.dpi(500)
.create(imgCandidate);
double score = new FingerprintMatcher()
.index(probe)
.match(candidate);
if (score >= 40) {
// Found a match
}
}
In my case, I found the performance a little slow. It was usable, but nothing compared to Android's built-in fingerprint device. Also, the bigger your digitals collection, the longer it will take to find a match.
The score of the match is up for you to decide what suits better your project. 40 was a reliable amount in my case. The same goes to the FingerprintTemplate dpi.
Also, the method .create() receives a byte[] as parameter.
EDIT
I found this link and I'm almost certain it is the library I used, but under a new repository name:
https://github.com/robertvazan/sourceafis-java
The docs looks just the same as the code I used: https://sourceafis.machinezoo.com/java
To match a user on server side, you have to use an AFIS server : https://en.wikipedia.org/wiki/Integrated_Automated_Fingerprint_Identification_System
Here some providers of AFIS solution:
http://www.neurotechnology.com/megamatcher.html
https://www.nec.com.au/expertise/safety-security/identity-access/fingerprint
https://www.innovatrics.com/innovatrics-abis/
https://www.dermalog.com/products/software/civil-afis-abis/
http://www.m2sys.com/automated-fingerprint-identification-system-afis/
My background is web development. Last year we started writing a native app with React native and the app is now live and kicking. Everything is working fine, but I'm wondering about the following problem.
With web development - if you have to add a new feature. You just go add it on the server, make modifications to the database, to the client/page and the next time a user visits your website the user can work with your new feature (mostly). But how do you do this on the native side when the user doesn't necessarily always run the latest version of the app?
Following situation.
We have user comments and system generated comments. We didn't account for the fact that we need to translate the system comments in different languages. So lets say that we have this structure for user comment:
{
id: "aqdfkah12"
author: {name: "xxx"}
text: 'my comment text"
}
and this would be a system comment
{
id: "aqdfkah13"
author: {name: "system"}
text: "The task was created."
}
In the new version of the app - instead of directly writing the translated string in the database - we are going to save a language constant.
{
id: "aqdfkah13"
author: {name: "system"}
text: {languageConstant: 'task_created'}
}
This works. In the new version we account for the fact that old comments had a string in the text field and in the new version we have a json. So we are able to show the old comments as they are and have the new system comments translated to the user's locale.
This works with the new version, but the app crashes on previous versions, because the code expected to have a string and now we are trying to directly output a json object and that is not valid.
We cannot possibly predict the database structure of the app for the future. We are always going to change things as the app evolves.
How do you deal with such situations?
I am trying to run the AWS android samples from https://github.com/awslabs/aws-sdk-android-samples
I have included the following jars in libs:
aws-android-sdk-2.0.4-cognito.jar
aws-android-sdk-2.0.4-core.jar
aws-android-sdk-2.0.4-s3.jar
Also I have added the AWS_ACCOUNT_ID, COGNITO_POOL_ID, COGNITO_ROLE_UNAUTH, BUCKET_NAME
this is the logcat
When im runnig this sample, action and then program shuts down.
What is problem?
I don't know what to do.
The stacktrace shows accountId is malformed. The accountId isn't your login email of your AWS account. Instead, it should be a 12 digit account number. One way to find it is to go to console -> My Account (top right corner).
PS: consider use the latest SDK version v2.2.2. It has lots of improvements compared to v2.0.4. You can find it at http://aws.amazon.com/mobile/sdk/.