app.getDeviceLocation()总是返回null

我已经成功地要求用户获得粗糙设备的权限,并且在用户允许权限之后,我检查了app.isPermissionGranted()从false转换为true,但是每当我使用app.getDeviceLocation() ,它都会返回null 。 当我询问“我在哪里?”时,我testing的Google Home会给出正确的位置。

这是我的代码片段:

  function askDate(app) { console.log('Permission:', app.isPermissionGranted()); //says true if (app.isPermissionGranted()) { //this always says null console.log('User device location:', JSON.stringify(app.getDeviceLocation())); app.ask('thanks for the location!'); } else { app.tell('You need to allow me to access your location to give an accurate recommendation'); } } function askForLocPermission(app) { console.log('Permission:', app.isPermissionGranted()); //says false let permission = app.SupportedPermissions.DEVICE_COARSE_LOCATION; app.data.permission = permission; app.askForPermission('To get weather near you', permission); //asks user for permission to get their zip code } 

我结束了与app.SupportedPermissions.DEVICE_PRECISE_LOCATIONtesting它,工作给了我我的坐标没有问题。 我希望Google修复粗略位置的错误(如果有的话)。