提交 d837c42d 编写于 作者: zyjhandsome's avatar zyjhandsome

NotificationManager修改为notificationManager,与命名空间保持一致。

Signed-off-by: zyjhandsome's avatarzyjhandsome <zyjhandsome@126.com>
上级 1c8a7c53
...@@ -34,13 +34,13 @@ ...@@ -34,13 +34,13 @@
1. 导入NotificationManager模块。 1. 导入NotificationManager模块。
```ts ```ts
import NotificationManager from '@ohos.notificationManager'; import notificationManager from '@ohos.notificationManager';
``` ```
2. 请求发送通知的许可。 2. 请求发送通知的许可。
```ts ```ts
NotificationManager.requestEnableNotification().then(() => { notificationManager.requestEnableNotification().then(() => {
console.info(`[ANS] requestEnableNotification success`); console.info(`[ANS] requestEnableNotification success`);
}).catch((err) => { }).catch((err) => {
console.error(`[ANS] requestEnableNotification failed, errCode[${err}]`); console.error(`[ANS] requestEnableNotification failed, errCode[${err}]`);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
2. 导入模块。 2. 导入模块。
```typescript ```typescript
import NotificationManager from '@ohos.notificationManager'; import notificationManager from '@ohos.notificationManager';
import wantAgent from '@ohos.app.ability.wantAgent'; import wantAgent from '@ohos.app.ability.wantAgent';
``` ```
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
// 构造NotificationRequest对象 // 构造NotificationRequest对象
let notificationRequest = { let notificationRequest = {
content: { content: {
contentType: NotificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: { normal: {
title: 'Test_Title', title: 'Test_Title',
text: 'Test_Text', text: 'Test_Text',
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
wantAgent: wantAgentObj, wantAgent: wantAgentObj,
} }
NotificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] failed to publish, error[${err}]`);
return; return;
......
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
2. 导入模块。 2. 导入模块。
```ts ```ts
import NotificationManager from '@ohos.notificationManager'; import notificationManager from '@ohos.notificationManager';
``` ```
3. 查询系统是否支持进度条模板,查询结果为支持downloadTemplate模板类通知。 3. 查询系统是否支持进度条模板,查询结果为支持downloadTemplate模板类通知。
```ts ```ts
NotificationManager.isSupportTemplate('downloadTemplate').then((data) => { notificationManager.isSupportTemplate('downloadTemplate').then((data) => {
console.info(`[ANS] isSupportTemplate success`); console.info(`[ANS] isSupportTemplate success`);
let isSupportTpl: boolean = data; // isSupportTpl的值为true表示支持支持downloadTemplate模板类通知,false表示不支持 let isSupportTpl: boolean = data; // isSupportTpl的值为true表示支持支持downloadTemplate模板类通知,false表示不支持
// ... // ...
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
let notificationRequest = { let notificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: NotificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: { normal: {
title: 'test_title', title: 'test_title',
text: 'test_text', text: 'test_text',
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
} }
// 发布通知 // 发布通知
NotificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] failed to publish, error[${err}]`);
return; return;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
## 接口说明 ## 接口说明
通知发布接口如下表所示,不同发布类型通知由[NotificationRequest](../reference/apis/js-apis-notification.md#notificationrequest)的字段携带不同的信息。 通知发布接口如下表所示,不同发布类型通知由[NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest)的字段携带不同的信息。
| **接口名** | **描述** | | **接口名** | **描述** |
| -------- | -------- | | -------- | -------- |
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
2. 导入模块。 2. 导入模块。
```ts ```ts
import NotificationManager from '@ohos.notificationManager'; import notificationManager from '@ohos.notificationManager';
``` ```
3. 构造NotificationRequest对象,并发布通知。 3. 构造NotificationRequest对象,并发布通知。
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
let notificationRequest = { let notificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: NotificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // 普通文本类型通知 contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // 普通文本类型通知
normal: { normal: {
title: 'test_title', title: 'test_title',
text: 'test_text', text: 'test_text',
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
} }
} }
NotificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] failed to publish, error[${err}]`);
return; return;
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
let notificationRequest = { let notificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: NotificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, // 长文本类型通知 contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, // 长文本类型通知
longText: { longText: {
title: 'test_title', title: 'test_title',
text: 'test_text', text: 'test_text',
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
} }
// 发布通知 // 发布通知
NotificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] failed to publish, error[${err}]`);
return; return;
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
let notificationRequest = { let notificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: NotificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, // 多行文本类型通知 contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, // 多行文本类型通知
multiLine: { multiLine: {
title: 'test_title', title: 'test_title',
text: 'test_text', text: 'test_text',
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
} }
// 发布通知 // 发布通知
NotificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] failed to publish, error[${err}]`);
return; return;
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
let notificationRequest = { let notificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: NotificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: { picture: {
title: 'test_title', title: 'test_title',
text: 'test_text', text: 'test_text',
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
} }
// 发布通知 // 发布通知
NotificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] failed to publish, error[${err}]`);
return; return;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
```js ```js
import reminderAgentManager from '@ohos.reminderAgentManager'; import reminderAgentManager from '@ohos.reminderAgentManager';
import NotificationManager from '@ohos.notificationManager'; import notificationManager from '@ohos.notificationManager';
``` ```
4. 定义目标提醒代理。开发者根据实际需要,选择定义如下类型的提醒。 4. 定义目标提醒代理。开发者根据实际需要,选择定义如下类型的提醒。
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
content: 'this is content', // 指明提醒内容 content: 'this is content', // 指明提醒内容
expiredContent: 'this reminder has expired', // 指明提醒过期后需要显示的内容 expiredContent: 'this reminder has expired', // 指明提醒过期后需要显示的内容
notificationId: 100, // 指明提醒使用的通知的ID号,相同ID号的提醒会覆盖 notificationId: 100, // 指明提醒使用的通知的ID号,相同ID号的提醒会覆盖
slotType: NotificationManager.SlotType.SOCIAL_COMMUNICATION // 指明提醒的Slot类型 slotType: notificationManager.SlotType.SOCIAL_COMMUNICATION // 指明提醒的Slot类型
} }
``` ```
- 定义日历实例。 - 定义日历实例。
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
expiredContent: 'this reminder has expired', // 指明提醒过期后需要显示的内容 expiredContent: 'this reminder has expired', // 指明提醒过期后需要显示的内容
snoozeContent: 'remind later', // 指明延迟提醒时需要显示的内容 snoozeContent: 'remind later', // 指明延迟提醒时需要显示的内容
notificationId: 100, // 指明提醒使用的通知的ID号,相同ID号的提醒会覆盖 notificationId: 100, // 指明提醒使用的通知的ID号,相同ID号的提醒会覆盖
slotType: NotificationManager.SlotType.SOCIAL_COMMUNICATION // 指明提醒的Slot类型 slotType: notificationManager.SlotType.SOCIAL_COMMUNICATION // 指明提醒的Slot类型
} }
``` ```
- 定义闹钟实例。 - 定义闹钟实例。
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
expiredContent: 'this reminder has expired', // 指明提醒过期后需要显示的内容 expiredContent: 'this reminder has expired', // 指明提醒过期后需要显示的内容
snoozeContent: 'remind later', // 指明延迟提醒时需要显示的内容 snoozeContent: 'remind later', // 指明延迟提醒时需要显示的内容
notificationId: 99, // 指明提醒使用的通知的ID号,相同ID号的提醒会覆盖 notificationId: 99, // 指明提醒使用的通知的ID号,相同ID号的提醒会覆盖
slotType: NotificationManager.SlotType.SOCIAL_COMMUNICATION // 指明提醒的Slot类型 slotType: notificationManager.SlotType.SOCIAL_COMMUNICATION // 指明提醒的Slot类型
} }
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册