中斷連線

如果使用者將 smart home 動作與 Google Assistant 取消連結,您的執行要求會收到 action.devices.DISCONNECT 意圖。這個意圖表示 Assistant 不會再為這位使用者傳送任何意圖,而您的雲端服務應停止為裝置呼叫 Google Home Graph API (Request Sync 和 Report State)。

要求
{
    "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
    "inputs": [{
      "intent": "action.devices.DISCONNECT",
    }]
}
JSON
{}
Node.js
const {smarthome} = require('actions-on-google');
const app = smarthome();
// ...
app.onDisconnect((body, headers) => {
  // TODO Disconnect user account from Google Assistant
  // You can return an empty body
  return {};
});
Java
@Override
public void onDisconnect(
    @NotNull DisconnectRequest disconnectRequest, @Nullable Map<?, ?> map) {
  // TODO Disconnect user account from Google Assistant
  // This function does not return anything
}

詳情請參閱 DISCONNECT 意圖參考說明文件。