Tham chiếu API

Notifications

Đọc thông báo đang hoạt động. Yêu cầu NotificationListenerService được bật trong cài đặt.

Định nghĩa kiểu

bash
type Notification {
  id: ID!
  onlyOnce: Boolean!       # "persistent" notification flag
  isClearable: Boolean!
  appId: String!           # package name
  appName: String!
  time: String!            # ISO 8601
  silent: Boolean!
  title: String!
  body: String!
  actions: [String!]!      # action button labels
  replyActions: [String!]! # labels of inline-reply actions
}

Thao tác

query

notifications

Liệt kê tất cả thông báo hiện đang hoạt động.

bash
query GetNotifications {
  notifications {
    id onlyOnce isClearable appId appName time silent title body
    actions replyActions
  }
}
mutation

cancelNotifications

Bỏ qua một hoặc nhiều thông báo theo ID.

bash
mutation CancelNotifications($ids: [ID!]!) {
  cancelNotifications(ids: $ids)
}
mutation

replyNotification

Gửi phản hồi đến một thông báo qua một hành động trả lời nội tuyến. actionIndex dựa trên 0 trong số các hành động có khả năng trả lời.

bash
mutation ReplyNotification($id: ID!, $actionIndex: Int!, $text: String!) {
  replyNotification(id: $id, actionIndex: $actionIndex, text: $text)
}