中斷連線

如果使用者取消您的 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 意圖參考資料說明文件。