Ngắt kết nối

Nếu người dùng huỷ liên kết Hành động smart home của bạn khỏi Google Assistant, thì phương thức thực hiện của bạn sẽ nhận được ý định action.devices.DISCONNECT. Ý định này cho biết Assistant sẽ không gửi thêm ý định nào cho người dùng này nữa và dịch vụ đám mây của bạn sẽ ngừng gọi API Google Home Graph (Request Sync và Report State) cho thiết bị của họ.

Yêu cầu
{
    "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
}

Để biết thêm thông tin, hãy xem tài liệu tham khảo về ý định DISCONNECT.