我正在尝试引用文档(https://developers.google.com/android/reference/com/google/android/gms/fitness/Fitness.html#SENSORS_API)中的Fitness.SENSOR_API。
在java中i导入
import com.google.android.gms.fitness.Fitness;
并像这样引用它
Fitness.SENSORS_API
但这似乎不适用于原生脚本(将其引用为com.google.android.gms.fitness.Fitness.SENSORS_API
)。
我已经记录了这个值:
console.log('fitness native module:',
com.google.android.gms.fitness.Fitness); //Fitness is undefined
对于com.google.android.gms.fitness
包中的其他类也是如此,例如这里引用的com.google.android.gms.fitness.FitnessOptions
:https://developers.google.com/android/reference/com/google/android/gms/fitness/FitnessOptions.Builder
总的来说,这是我想要做的:
googleApiClient = new com.google.android.gms.common.api.GoogleApiClient.Builder(activity)
.addApi(com.google.android.gms.fitness.Fitness.SENSORS_API)
.addApi(com.google.android.gms.fitness.Fitness.HISTORY_API)
.addApi(com.google.android.gms.fitness.Fitness.RECORDING_API)
.addScope('https://www.googleapis.com/auth/fitness.activity.read')
.addScope('https://www.googleapis.com/auth/fitness.activity.write')
.addScope('https://www.googleapis.com/auth/fitness.location.read')
.build();
我确实有
dependencies {
implementation 'com.google.android.gms:play-services-fitness:16.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
}
在我的App_Resources/Android/app.gradle文件中。
我是不是遗漏了什么?我需要扩展或实现一些类吗?为什么没有定义Fitness?
我的总体目标是遵循这些文档(https://developers.google.com/fit/android/get-started)并连接到谷歌健身API
发布于 2019-05-15 13:51:00
尝试干净的构建以确保正确安装依赖项,只有在这种情况下,访问包才可能返回undefined。
tns platform clean android
https://stackoverflow.com/questions/56122041
复制相似问题