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

asp影楼网站设计网站站长seo推广

asp影楼网站设计,网站站长seo推广,黑龙江网站备案管理局,政府网站建设高端会议意图通知 获取router事件中传递参数并跳转 目前点击通知消息打开应用的指定页面,通过为通知添加行为意图的方式。也就是在wants的parameters中设置自定义参数,然后在UIAbility的onNewWant或者onCreate方法中 解析配置的自定义参数信息判断跳转不同页面&a…

意图通知
获取router事件中传递参数并跳转
目前点击通知消息打开应用的指定页面,通过为通知添加行为意图的方式。也就是在wants的parameters中设置自定义参数,然后在UIAbility的onNewWant或者onCreate方法中 解析配置的自定义参数信息判断跳转不同页面,参考文档:
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/notification-with-wantagent-V5
在UIAbility根据传递的params不同,选择拉起不同的页面可参考:
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-ui-widget-event-router-V5

import { NavBar } from '../component/NavBar';
import { notificationManager } from '@kit.NotificationKit';
import { common, wantAgent } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { BusinessError } from '@kit.BasicServicesKit';@Component
@Entry
struct DemoNotification {@State TAG: string = '[PublishOperation]';@State DOMAIN_NUMBER: number = 0xFF00;@State wantAgentInfo: wantAgent.WantAgentInfo = {wants: [{bundleName: "com.example.yumi",abilityName: "EntryAbility"}],operationType: wantAgent.OperationType.START_ABILITY,requestCode: 100};onPageShow(): void {// 请求通知授权let context = getContext(this) as common.UIAbilityContext;notificationManager.isNotificationEnabled().then((data: boolean) => {hilog.info(this.DOMAIN_NUMBER, this.TAG, "isNotificationEnabled success, data: " + JSON.stringify(data));if (!data) {notificationManager.requestEnableNotification(context).then(() => {hilog.info(this.DOMAIN_NUMBER, this.TAG, `[ANS] requestEnableNotification success`);}).catch((err: BusinessError) => {if (1600004 == err.code) {hilog.error(this.DOMAIN_NUMBER, this.TAG,`[ANS] requestEnableNotification refused, code is ${err.code}, message is ${err.message}`);} else {hilog.error(this.DOMAIN_NUMBER, this.TAG,`[ANS] requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);}});}}).catch((err: BusinessError) => {hilog.error(this.DOMAIN_NUMBER, this.TAG,`isNotificationEnabled fail, code is ${err.code}, message is ${err.message}`);});// 通知角标let badgeNumber: number = 10;notificationManager.setBadgeNumber(badgeNumber).then(() => {hilog.info(this.DOMAIN_NUMBER, this.TAG, `setBadgeNumber 10 success.`);badgeNumber = 11;notificationManager.setBadgeNumber(badgeNumber).then(() => {hilog.info(this.DOMAIN_NUMBER, this.TAG, `setBadgeNumber 11 success.`);});});}publishNotification() {let notificationRequest: notificationManager.NotificationRequest = {// 描述通知的请求id: 1, // 通知IDcontent: {// 通知内容notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // 普通文本类型通知normal: {// 基本类型通知内容title: '通知内容标题',text: '通知内容详情'}}}// addslot回调let addSlotCallBack = (err: BusinessError): void => {if (err) {hilog.info(this.DOMAIN_NUMBER, this.TAG, `addSlot failed, code is ${err.code}, message is ${err.message}`);} else {hilog.info(this.DOMAIN_NUMBER, this.TAG, `addSlot success`);}}notificationManager.addSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack);notificationManager.publish(notificationRequest).then(() => { // 发布通知console.info('publish success');}).catch((err: Error) => {console.error(`publish failed,message is ${err}`);});}async publishNotificationWant() {let wantAgentInfo: wantAgent.WantAgentInfo = {wants: [{bundleName: "com.example.yumi", // 自己应用的bundleNameabilityName: "EntryAbility",parameters: { page: 'view/Car' } // 自己点击通知需要跳转的页面}],operationType: wantAgent.OperationType.START_ABILITIES,requestCode: 1,}const wantAgentObj = await wantAgent.getWantAgent(wantAgentInfo)await notificationManager.publish({content: {notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,normal: {title: "测试标题",text: "测试内容",}},id: 1,wantAgent: wantAgentObj})}build() {Column() {NavBar({ title: '通知' })Button('发送文本类型通知').onClick(() => {this.publishNotification()})Button('发送通知-为通知添加行为意图').onClick(() => {this.publishNotificationWant()})}}
}
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { router, Router, window } from '@kit.ArkUI';
import { DialogHelper } from '@pura/harmony-dialog';
import { AppUtil } from '@pura/harmony-utils'export default class EntryAbility extends UIAbility {onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');AppUtil.init(this.context)}onDestroy(): void {hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');}onWindowStageCreate(windowStage: window.WindowStage): void {// Main window is created, set main page for this abilityhilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');windowStage.loadContent('pages/Splash')}onWindowStageDestroy(): void {// Main window is destroyed, release UI related resourceshilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');}onForeground(): void {// Ability has brought to foregroundhilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');}onBackground(): void {// Ability has back to backgroundhilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');}onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onNewWant');//点击Notification通知并打开App的具体页面let page = want?.parameters?.page  as stringrouter.pushUrl({url: page})console.log('want参数'+want?.parameters?.page)}
}
http://www.jinmujx.cn/news/80578.html

相关文章:

  • 笔记本怎么做1920宽的网站app定制开发
  • 外贸论坛网站有哪些关键词排名优化易下拉霸屏
  • 帮别人设计做关于图的网站百度软件中心下载
  • 宁波网站建设培训小视频关键词汇总
  • 做网站需要用到ps吗产品seo基础优化
  • 自己做个公司网站网站运营推广选择乐云seo
  • 深圳防疫最新进展seo三人行论坛
  • 哪些网站可以做四六级真题教育培训机构加盟
  • 做电器哪个网站好今天株洲最新消息
  • 湖北省建设主管网站一站式推广平台
  • 装修公司怎么做网站推广搜索引擎优化seo专员
  • 软件开发培训哪里好seo怎么刷关键词排名
  • 域名价格一览表网页seo搜索引擎优化
  • 做外贸要建什么网站怎么建个网站
  • 爱站网功能网址
  • 律师网站素材免费的域名和网站
  • 容桂销售型网站建设直播营销的优势有哪些
  • 哪里有做鸭的网站贵阳seo网站管理
  • 京东网站设计风格移动排名提升软件
  • 网站建设的目的怎样做好服务营销
  • 大型网站建设方案关键词如何优化排名
  • 网站建设长期待摊费用在线服务器网站
  • 做减肥网站怎么让客户主动找你
  • 使用joomla的网站学it学费大概多少钱
  • 苏州实力做网站公司有哪些北京优化核酸检测
  • 用花生棒自己做内网网站百度提问登录入口
  • 镜像的网站怎么做排名百度互联网营销
  • 做流量网站市场营销说白了就是干什么的
  • 网站建设教学seo关键词首页排名
  • 喜欢做网站的行业seo在线诊断工具