Closed pranatha closed 3 years ago
yes running into this
I'm running into the same issue when I define the versions for fitnessPlayServices
and authPlayServices
in build.gradle
as stated in the documentation. Seems like it doesn't work with fitness play services version 19.0.0 and higher.
ext {
fitnessPlayServices: "20.0.0" // default: 17.0.0
authPlayServices: "19.0.0" // default: 17.0.0
}
To keep using certain permissions you have to upgrade to version 20 of the fitness SDK by April 27th: https://developers.google.com/fit/improvements
The problem seems to lie in android/src/main/java/com/ovalmoney/fitness/manager/Manager.java
The subscribeToActivity
function uses DataType.TYPE_ACTIVITY_SAMPLES
, I can't find any notion of this DataType in the latest documentation of the Google Fit SDK.
public void subscribeToActivity(Context context, final Promise promise){
final GoogleSignInAccount account = GoogleSignIn.getLastSignedInAccount(context);
if(account == null){
promise.resolve(false);
return;
}
Fitness.getRecordingClient(context, account)
.subscribe(DataType.TYPE_ACTIVITY_SAMPLES)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
promise.resolve(true);
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
promise.resolve(false);
}
});
}
I've been trying to understand what's happening. I think the DataType TYPE_ACTIVITY_SAMPLES
has been deprecated in the current version of the Fit SDK. With the coming of stricter oauth permissions it doesn't seem allowed to subscribe to this anymore. I think the easiest solution would be to remove the subscribeToActivity
function in the Manager.java
. I don't know Java enough to suggest a new implementation, I think it would mean subscribing to whatever needed DataType individually.
Hi @rlems , thank you for your specification.
We are working to update android SDK and find a way to fix also activity. If it is not possible we will probably remove.
Hi @Francesco-Voto, Just wondering what your timeline on this is? As far as I understand the Google Fit documentation, this needs to be implemented before the 27th of April. But maybe I'm understanding that wrong. Thank you for your time
My App cannot be compiled to Android due to usage of deprecated API
macOS Version Catalina 10.15.5
Java Environment java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
React Native Version v0.62.2
react-native-fitness v0.4.0
Step to reproduce run
yarn run android