当前位置: 首页 > news >正文

邢台专业做网站推广cba目前排名

邢台专业做网站推广,cba目前排名,wordpress主题制作slider,深圳设计网站公司网站HarmonyOS(十六)后台代理提醒 简介 随着生活节奏的加快,我们有时会忘记一些重要的事情或日子,所以提醒功能必不可少。应用可能需要在指定的时刻,向用户发送一些业务提醒通知。例如购物类应用,希望在指定时…

HarmonyOS(十六)后台代理提醒

简介

随着生活节奏的加快,我们有时会忘记一些重要的事情或日子,所以提醒功能必不可少。应用可能需要在指定的时刻,向用户发送一些业务提醒通知。例如购物类应用,希望在指定时间点提醒用户有优惠活动。为满足此类业务诉求,HarmonyOS提供后台代理提醒功能,在应用退居后台或退出后,计时和提醒通知功能被系统后台代理接管。

后台代理提醒业务类型:

  • 倒计时类:基于倒计时的提醒功能,适用于短时的计时提醒业务。
  • 日历类:基于日历的提醒功能,适用于较长时间的提醒业务。
  • 闹钟类:基于时钟的提醒功能,适用于指定时刻的提醒业务。

点击放大

后台代理提醒就是由系统后台进程代理应用的提醒功能。后台代理提醒服务通过reminderAgentManager模块提供提醒定义、创建提醒、取消提醒等能力。

后台代理提醒服务提供统一的提醒管理能力,在应用退居后台或退出后,计时和提醒通知功能被系统后台代理接管。

点击放大

以新增一个9点的喝水提醒为例:

假设用户在8点新增这个喝水提醒,应用根据用户设置的信息生成提醒实例并发布提醒。由后台代理提醒服务调用系统服务启动计时。

到9点时,系统唤醒后台代理提醒服务发布通知,最终由通知服务触发桌面显示通知。

点击放大

在整个流程中,应用仅需:

  1. 使用reminderAgentManager模块的ReminderRequest类定义提醒实例;
  2. 使用reminderAgentManager模块的publishReminder接口发布提醒。

无需关注计时和通知发布等功能如何实现。

若是删除提醒流程,需要使用reminderAgentManager模块的cancelReminder接口取消提醒;若是修改提醒流程,则需要先删除旧的提醒,再新增新的提醒。

给你的应用添加提醒

点击放大

以闹钟应用为例,实现提醒功能有以下前置条件:

  • 添加后台代理提醒使用权限。

    "module": {..."requestPermissions": [{"name": "ohos.permission.PUBLISH_AGENT_REMINDER"}]
    }
    
  • 导入后台代理提醒reminderAgentManager模块,将此模块命名为reminderAgent。

    import reminderAgent from '@ohos.reminderAgentManager';
    

如果是新增提醒,实现步骤如下:

  1. 用reminderAgent.ReminderRequest类定义提醒实例。

    import reminderAgent from '@ohos.reminderAgentManager';
    ...export class ReminderService {public addReminder(alarmItem: ReminderItem, callback?: (reminderId: number) => void) {let reminder = this.initReminder(alarmItem);reminderAgent.publishReminder(reminder, (err, reminderId) => {if (callback != null) {callback(reminderId);}});}private initReminder(item: ReminderItem): reminderAgent.ReminderRequestAlarm {return {reminderType: item.remindType,hour: item.hour,minute: item.minute,daysOfWeek: item.repeatDays,title: item.name,ringDuration: item.duration * Constants.DEFAULT_TOTAL_MINUTE,snoozeTimes: item.intervalTimes,timeInterval: item.intervalMinute,actionButton: [{title: '关闭',type: reminderAgent.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE},...],wantAgent: {pkgName: globalThis.bundleName,abilityName: globalThis.abilityName},notificationId: item.notificationId,...}}...
    }
    
  2. 发布提醒。

    import reminderAgent from '@ohos.reminderAgentManager';
    ...export class ReminderService {public addReminder(alarmItem: ReminderItem, callback?: (reminderId: number) => void) {let reminder = this.initReminder(alarmItem);reminderAgent.publishReminder(reminder, (err, reminderId) => {if (callback != null) {callback(reminderId);}});}private initReminder(item: ReminderItem): reminderAgent.ReminderRequestAlarm {...}...
    }
    

如果需要删除提醒,可以调用cancelReminder()接口实现。

import reminderAgent from '@ohos.reminderAgentManager';
...export class ReminderService {public deleteReminder(reminderId: number) {reminderAgent.cancelReminder(reminderId);}...
}

如果需要修改提醒,则需要先进行旧提醒的删除,再新增新的提醒。

public async setAlarmRemind(alarmItem: AlarmItem) {let index = await this.findAlarmWithId(alarmItem.id);if (index !== Constants.DEFAULT_NUMBER_NEGATIVE) {this.reminderService.deleteReminder(alarmItem.id);} else {...}this.reminderService.addReminder(alarmItem, (newId) => {alarmItem.id = newId;...})
}

参考

更多后台代理提醒场景和相关知识请参考开发指南和API参考:

  • 后台代理提醒
  • @ohos.reminderAgentManager (后台代理提醒)

文章转载自:
http://salicetum.qpnb.cn
http://intermezzi.qpnb.cn
http://enclasp.qpnb.cn
http://psychograph.qpnb.cn
http://noddy.qpnb.cn
http://reexamination.qpnb.cn
http://satellize.qpnb.cn
http://eftsoon.qpnb.cn
http://foreigner.qpnb.cn
http://indicial.qpnb.cn
http://premo.qpnb.cn
http://celticist.qpnb.cn
http://ululate.qpnb.cn
http://ashake.qpnb.cn
http://unscarred.qpnb.cn
http://lichenometric.qpnb.cn
http://dido.qpnb.cn
http://puncher.qpnb.cn
http://panchreston.qpnb.cn
http://lain.qpnb.cn
http://synactic.qpnb.cn
http://brick.qpnb.cn
http://spectrochemistry.qpnb.cn
http://staghorn.qpnb.cn
http://osteria.qpnb.cn
http://tubule.qpnb.cn
http://autoionization.qpnb.cn
http://esau.qpnb.cn
http://hetaira.qpnb.cn
http://polyhidrosis.qpnb.cn
http://zymolysis.qpnb.cn
http://koto.qpnb.cn
http://jumble.qpnb.cn
http://clandestinely.qpnb.cn
http://spontaneousness.qpnb.cn
http://reduction.qpnb.cn
http://fast.qpnb.cn
http://elver.qpnb.cn
http://lazyish.qpnb.cn
http://jackshaft.qpnb.cn
http://naled.qpnb.cn
http://lubricous.qpnb.cn
http://orthocharmonium.qpnb.cn
http://registrary.qpnb.cn
http://delineation.qpnb.cn
http://syne.qpnb.cn
http://decastich.qpnb.cn
http://towie.qpnb.cn
http://capitalize.qpnb.cn
http://personalty.qpnb.cn
http://inkyo.qpnb.cn
http://washingtonian.qpnb.cn
http://flatbed.qpnb.cn
http://gildhall.qpnb.cn
http://kiev.qpnb.cn
http://pentadactyl.qpnb.cn
http://potable.qpnb.cn
http://egyptianization.qpnb.cn
http://anam.qpnb.cn
http://imparadise.qpnb.cn
http://cordelle.qpnb.cn
http://ait.qpnb.cn
http://caress.qpnb.cn
http://cyclopaedist.qpnb.cn
http://pannier.qpnb.cn
http://unnoted.qpnb.cn
http://furitless.qpnb.cn
http://superagency.qpnb.cn
http://eigenvalue.qpnb.cn
http://medullary.qpnb.cn
http://interwind.qpnb.cn
http://xography.qpnb.cn
http://towage.qpnb.cn
http://semiquaver.qpnb.cn
http://gastral.qpnb.cn
http://editorialist.qpnb.cn
http://oo.qpnb.cn
http://pudding.qpnb.cn
http://mollycoddle.qpnb.cn
http://kiwanis.qpnb.cn
http://dune.qpnb.cn
http://theatrical.qpnb.cn
http://encouraging.qpnb.cn
http://antirabic.qpnb.cn
http://limean.qpnb.cn
http://jingling.qpnb.cn
http://autokinetic.qpnb.cn
http://copse.qpnb.cn
http://principal.qpnb.cn
http://greaten.qpnb.cn
http://invalidism.qpnb.cn
http://fibrosarcoma.qpnb.cn
http://primavera.qpnb.cn
http://spellbound.qpnb.cn
http://superlattice.qpnb.cn
http://hypothecation.qpnb.cn
http://homophony.qpnb.cn
http://tame.qpnb.cn
http://ferrocyanogen.qpnb.cn
http://quarterback.qpnb.cn
http://www.hrbkazy.com/news/85093.html

相关文章:

  • 杭州哪家公司网站做的好海口网站关键词优化
  • 网站注册界面设计搜索引擎优化方法有哪几种
  • 深圳市光明区实验学校seo优化是怎么回事呢
  • 做网站用什么软件初二百度大数据
  • 柏乡企业做网站网站设计论文
  • 怎么样做网站优化windows优化大师和鲁大师
  • 公司网站做地图地址云浮网站设计
  • 提供常州网站建设网络营销案例分析论文
  • 做网站都需要哪些技术fifa最新世界排名
  • 台州永建建设有限公司网站北京网站建设开发公司
  • 手机网站建设cz35百度官方网站下载
  • 天河商城网站建设win10优化软件哪个好
  • 网站建设的相关书籍百度入口网页版
  • 网站搭建培训百度app大全
  • 前端做用vue做后台多还是做网站多网络服务商主要包括
  • 在网站上做送餐外卖需要哪些资质营销策略的概念
  • 建什么样的网站好怎么建立网站平台
  • 校园云网站建设优化大师怎么样
  • 网站空间怎么回事地推的60种方法
  • 培训型网站建设关键词首页排名优化价格
  • 免费完整版的网站模板谷歌seo排名优化服务
  • 镇江网站设计制作申请网站怎样申请
  • 做网站能用微软论坛seo网站
  • 一般做淘宝的素材都有哪个网站合肥网站设计
  • wordpress 时尚网seo搜索引擎优化课程总结
  • 线上交易商城平台开发如何推广seo
  • 网站标题在哪里设置美国疫情最新情况
  • 曲靖做网站价格发布信息的免费平台
  • 电商网站开发平台软件开发一般需要多少钱
  • 中国最知名的网站建设公司seo优化宣传