推送通知
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
概览
借助 Google 移动流量套餐共享 API,运营商还可以通过推送 PlanStatus 向用户发送通知。
该 API 目前支持以下通知:
- 低余额:当 PlanModule.coarseBalanceLevel 设置为 LOW_QUOTA 时
- 数据不足:当 PlanModule.coarseBalanceLevel 设置为 OUT_OF_DATA 时。
此外,如果 PlanModule.overUsagePolicy 设置为 PAY_AS_YOU_GO,系统会通知用户他们即将进入随用随付模式。
- 数据到期时间警告:当 PlanModule.planModuleState 设置为 EXPIRING_SOON 时
- Plan Activation:当 PlanModule.planModuleState 设为 NEWLY_ACTIVE 时
- 随用随付:在 AccountInfo.payAsYouGoCharge 中填充用户消费的金额时。如果已填充 accountBalance,则通知会显示帐号的剩余余额。
- 帐号充值:填充了 AccountInfo.accountTopUp 和 AccountInfo.accountBalance 时。必须填写这两个字段才能向用户发送帐号充值通知。如果 AccountInfo.accountTopUp 中的单位数和纳米值均设置为零,则通知中不包含充值金额。
- 数据到期时间:当 PlanModule.planModuleState 设置为 EXPIRED 时。这适用于已过期的方案。
系统会针对每个字段集向用户发送一条通知。如果在一个 PlanStatus
中设置了多个 coarseBalanceLevel
或 planModuleState
字段,系统会向用户发送相同数量的通知。
触发通知的方案状态会发送到用户设备以更新设备缓存。这会在用户点击通知时显示最近的方案状态,从而改善用户体验。如果用于发送通知的计划状态不完整,不应向用户显示,则运营商必须将 UiCompatibility 设置为 UI_INCOMPATIBLE
。
要求
通知 PlanStatus 应尽可能多地包含有关用户移动套餐的信息。对于每种类型的通知,Data Plan Sharing API 还定义了构建通知文本所需的最小字段集。运营商必须在通知 PlanStatus 中包含这些字段。
通知 |
必填字段 |
余额不足 |
PlanModule.moduleName、PlanModule.byteBalance.remainingBytes |
数据不足 |
PlanModule.moduleName |
数据到期警告 |
PlanModule.moduleName、PlanModule.expirationTime |
激活方案 |
PlanModule.moduleName |
随用随付 |
AccountInfo.payAsYouGoCharge |
帐号充值 |
AccountInfo.accountTopUp |
数据有效期 |
PlanModule.moduleName |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2022-09-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2022-09-26。"],[[["The Google Mobile Data Plan Sharing API enables operators to send various plan-related notifications to users, such as low balance, out-of-data, and plan expiration warnings."],["Notifications are triggered by specific plan status updates and include relevant information about the user's plan, improving the user experience."],["Operators must include certain required fields for each notification type to ensure the notification text can be generated properly."],["The API supports sending multiple notifications simultaneously if multiple status fields are updated within a single PlanStatus."],["Carriers should set UiCompatibility to UI_INCOMPATIBLE if the notification's plan status is incomplete and shouldn't be displayed to the user directly."]]],[]]