簡體   English   中英

如何從Google家用設備獲取用戶位置

[英]How to get user location from google home device

如何實現此示例:

      let device = this.googleAction().getRequest().getDevice();
      console.log(device);
      this.tell('Thanks for your precise location');

https://raw.githubusercontent.com/jovotech/jovo-framework-nodejs/master/examples/google_action_specific/appAskForPermission.js

您是否首先要求“精確位置”(如您所鏈接的示例所示)?

this.googleAction().askForPreciseLocation('Precise Location pre text');

如果用戶授予您權限,則它會跳到“ ON_PERMISSION”處理程序,您可以在其中訪問信息,如下所述:

 if (requestUser.permissions.indexOf('DEVICE_PRECISE_LOCATION') > -1) {
        let device = this.googleAction().getRequest().getDevice();
        console.log(device);
        this.tell('Thanks for your precise location');
    }

您可以在Jovo Docs中找到更多信息: Google助手>數據> ON_PERMISSION

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM