Ngắt kết nối

Nếu người dùng huỷ liên kết Thao tác smart home của bạn với Google Assistant, thì yêu cầu thực hiện của bạn sẽ nhận được một ý định action.devices.DISCONNECT. Ý định này cho biết rằng 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 nên ngừng gọi các 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.