add notification permission status
This commit is contained in:
1 parent
1c3886e10c
commit
b52d3e4281
4 files changed
+158
No files matched your search
@@ -111,6 +111,7 @@ WiFi options:
|
||||
|
||||
```js
|
||||
BluememeUtils.requestPushPermission(success, error);
|
||||
BluememeUtils.getPushPermissionStatus(success, error);
|
||||
BluememeUtils.getFirebaseToken(function (result) {
|
||||
console.log(result.token);
|
||||
}, error);
|
||||
@@ -134,6 +135,31 @@ BluememeUtils.getInitialNotification(success, error);
|
||||
BluememeUtils.stopNotificationListener(success, error);
|
||||
```
|
||||
|
||||
`getPushPermissionStatus` 只读取当前系统通知状态,不弹授权框。可用于填充后端 `NotificationsEnabled`。
|
||||
|
||||
返回示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "notification",
|
||||
"platform": "Android",
|
||||
"enabled": true,
|
||||
"granted": true,
|
||||
"runtimePermissionGranted": true,
|
||||
"appNotificationsEnabled": true,
|
||||
"authorizationStatus": "authorized",
|
||||
"missing": []
|
||||
}
|
||||
```
|
||||
|
||||
推荐注册 token 前调用:
|
||||
|
||||
```js
|
||||
BluememeUtils.getPushPermissionStatus(function (status) {
|
||||
var notificationsEnabled = status.enabled === true;
|
||||
}, error);
|
||||
```
|
||||
|
||||
事件也会派发到 `window`:
|
||||
|
||||
- `bluememeutils.token`
|
||||
|
||||
Reference in new issue
Block a user