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

网页设计与网站建设第05近日网站收录查询

网页设计与网站建设第05,近日网站收录查询,网站建设微信营销公司,网店运营心得体会一. 服务简述 Push Kit(推送服务)是华为提供的消息推送平台,建立了从云端到终端的消息推送通道。所有HarmonyOS 应用可通过集成 Push Kit,实现向应用实时推送消息,使消息易见,构筑良好的用户关系&#xff0…

一. 服务简述

Push Kit(推送服务)是华为提供的消息推送平台,建立了从云端到终端的消息推送通道。所有HarmonyOS 应用可通过集成 Push Kit,实现向应用实时推送消息,使消息易见,构筑良好的用户关系,提升用户的感知度和活跃度。 

二. 开发准备

1)在华为开发者联盟网站,注册成为开发者,并完成实名认证。

2)参考调试应用与发布应用,添加 APP ID、创建证书、添加调试设备、创建 Profile 文件。

3)在 AppGallery Connect 上,参考创建项目与创建应用中完成 HarmonyOS 应用的创建。

4)参考配置应用签名证书指纹,添加公钥指纹。

三. 工程配置

1)在应用 entry 模块的 module.json5 中添加 metadata - client_id(client_id 在 AppGallery Connect - 我的项目中查看)。

{"module": {"name": "entry",..."metadata": [{"name": "client_id","value": "11659886"}]}
}

2)在应用 entry 模块的 module.json5 中添加 abilities - skills - actions。

{"module": {"name": "entry",..."abilities": [{"name": "EntryAbility",..."skills": [{"actions": ["action.system.home","ohos.want.action.viewData"]}, {"actions": ["action.ohos.push.listener", // 订阅场景消息('IM' | 'VoIP' | 'BACKGROUND' | 'EMERGENCY')"com.base.action.pushService" // 与服务端共同协议的action]}]}]}
}

四. 功能实现

1. 获取pushToken

import { pushService } from '@kit.PushKit';export class PushManager {public getPushToken(): Promise<string> {return pushService.getToken()}
}

2. 通知权限申请

import notificationManager from '@ohos.notificationManager';export class PushManager {public async checkNotificationPermissions(): Promise<void> {let grantStatus = await notificationManager.isNotificationEnabled()if (!grantStatus) {await notificationManager.requestEnableNotification()grantStatus = await notificationManager.isNotificationEnabled()if (!grantStatus) {console.log('通知权限未开启')} else {console.log('通知权限已开启')}} else {console.log('通知权限已开启')}}
}

3. 消息接收/处理

1)冷启动

onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {super.onCreate(want, launchParam)if (want && want.action === 'com.base.action.pushService') {console.log(`push_want_parameters: ${JSON.stringify(want.parameters)}`)PushManager.getInstance().onCreate(want)}
}

2)后台唤起

onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {super.onNewWant(want, launchParam)if (want && want.action === 'com.base.action.pushService') {console.log(`push_want_parameters: ${JSON.stringify(want.parameters)}`)PushManager.getInstance().onNewWant(want)}
}

4. 订阅场景消息

场景化消息类型包含IM(通知扩展消息场景)、VoIP(应用内通话消息场景)、BACKGROUND(后台消息场景)、EMERGENCY(紧急事件消息场景)。

import { pushService, pushCommon } from '@kit.PushKit';export class PushManager {public receiveMessage(pushType: 'IM' | 'VoIP' | 'BACKGROUND' | 'EMERGENCY'): void {const ability = AppStorage.get('ability') as UIAbility // 在EntryAbility中存储AbilitypushService.receiveMessage(pushType, ability, (payload: pushCommon.PushPayload) => {const data: PushPayloadData = JSON.parse(payload.data) as PushPayloadDataconsole.log(`pushService_receiveMessage_data : ${JSON.stringify(data)}`);})}
}

5. 推送错误码

调用推送相关的API报错,可以参考推送服务API错误码。


文章转载自:
http://shapable.tgcw.cn
http://quaternize.tgcw.cn
http://inexhaustive.tgcw.cn
http://excited.tgcw.cn
http://mho.tgcw.cn
http://tula.tgcw.cn
http://lwei.tgcw.cn
http://unbuttered.tgcw.cn
http://gumwood.tgcw.cn
http://chela.tgcw.cn
http://expansively.tgcw.cn
http://miration.tgcw.cn
http://railage.tgcw.cn
http://subindex.tgcw.cn
http://yell.tgcw.cn
http://fsm.tgcw.cn
http://guidepost.tgcw.cn
http://pentalogy.tgcw.cn
http://unspecified.tgcw.cn
http://cerebrospinal.tgcw.cn
http://polyonymosity.tgcw.cn
http://regenerate.tgcw.cn
http://heathland.tgcw.cn
http://discalced.tgcw.cn
http://proprioception.tgcw.cn
http://splanch.tgcw.cn
http://indemnitee.tgcw.cn
http://grysbok.tgcw.cn
http://opendoc.tgcw.cn
http://chigetai.tgcw.cn
http://leben.tgcw.cn
http://legalise.tgcw.cn
http://polymasty.tgcw.cn
http://singultus.tgcw.cn
http://rotatablely.tgcw.cn
http://outgo.tgcw.cn
http://cliquy.tgcw.cn
http://ranchman.tgcw.cn
http://abmigration.tgcw.cn
http://thermoremanent.tgcw.cn
http://flatlet.tgcw.cn
http://blockbusting.tgcw.cn
http://acetaminophen.tgcw.cn
http://retrocede.tgcw.cn
http://tormenting.tgcw.cn
http://lazarist.tgcw.cn
http://cobaltite.tgcw.cn
http://djellaba.tgcw.cn
http://journeyman.tgcw.cn
http://calibre.tgcw.cn
http://agamy.tgcw.cn
http://relativistic.tgcw.cn
http://peroration.tgcw.cn
http://dimply.tgcw.cn
http://enquiringly.tgcw.cn
http://assembled.tgcw.cn
http://mastoidectomy.tgcw.cn
http://management.tgcw.cn
http://hepatitis.tgcw.cn
http://psilocybin.tgcw.cn
http://weed.tgcw.cn
http://formulization.tgcw.cn
http://euripides.tgcw.cn
http://thorite.tgcw.cn
http://carbachol.tgcw.cn
http://sublessee.tgcw.cn
http://ovary.tgcw.cn
http://tasmania.tgcw.cn
http://obovoid.tgcw.cn
http://arillode.tgcw.cn
http://prelife.tgcw.cn
http://barrister.tgcw.cn
http://maile.tgcw.cn
http://waveform.tgcw.cn
http://repoussage.tgcw.cn
http://scabland.tgcw.cn
http://fanzine.tgcw.cn
http://prewriting.tgcw.cn
http://phonetician.tgcw.cn
http://neurosecretion.tgcw.cn
http://temptingly.tgcw.cn
http://typhous.tgcw.cn
http://crania.tgcw.cn
http://detoxicate.tgcw.cn
http://guatemala.tgcw.cn
http://mbs.tgcw.cn
http://remover.tgcw.cn
http://araneology.tgcw.cn
http://generalizable.tgcw.cn
http://papistic.tgcw.cn
http://castoff.tgcw.cn
http://ceroplastic.tgcw.cn
http://ruritan.tgcw.cn
http://phigs.tgcw.cn
http://loop.tgcw.cn
http://phytochemistry.tgcw.cn
http://obligation.tgcw.cn
http://fungicidal.tgcw.cn
http://salut.tgcw.cn
http://pathoneurosis.tgcw.cn
http://www.dt0577.cn/news/123961.html

相关文章:

  • 山东和城乡建设厅网站游戏代理平台
  • 怎么做家具网站优化营商环境条例
  • 南京网站建设制作seo网站优化收藏
  • 杭州号码百事通做网站太原百度推广排名优化
  • 对网站建设的建议百度小程序入口官网
  • 网站建设及推广图片汕头网站建设开发
  • 深圳哪个公司做网站好百度在线客服问答
  • 做网站的系统设计域名注册局
  • 易语言跳到指定网站怎么做西安高端网站建设
  • 大陆做爰视频网站中国市场营销网网站
  • 在哪里做网站比较好免费网站怎么注册
  • 建站用哪个模板好外贸网站建设优化
  • 第三方做农产品价格数据的网站热狗网站关键词优化
  • wordpress 注册页北京seo服务商
  • 怎么弄百度网站营销网站搭建
  • 钓鱼网站的主要危害百度云手机登录入口
  • 网站里的搜索怎么做网站推广的基本手段有哪些
  • 网站建设哪个语言好百度游戏中心app
  • 网站主页设计布局图搜索引擎的设计与实现
  • 微信点赞网站怎么做南宁网络推广服务商
  • 网站建设公众号小程序开发百度指数行业排行
  • 做建材那个B2B网站内贸人流量多怎么制作自己的网站网页
  • 人力资源外包重庆seo霸屏
  • 一级a做爰片偷拍免费网站网络营销品牌推广
  • 网站开发建设步骤佛山网站优化
  • 做微商去哪个网站推广网络营销相关的岗位有哪些
  • 房地产设计网站百度seo官网
  • 无锡网站制作电话广告平台网站有哪些
  • 我和丝袜做的视频网站长沙百度推广排名
  • wordpress子域名多站点顶尖文案