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

wordpress 音乐主题爱站seo综合查询

wordpress 音乐主题,爱站seo综合查询,做门户网站用什么模板,网站商城系统建设一、引言 在开发App时避免不了需要推送系统通知,以提高用户的使用体验。在自己的一个工具型的小app上全流程接入了uni-push2.0的推送能力,做个记录,以防后期需要用到。在阅读本教程前最好先看看官方文档,结合官方文档使用&#xf…

一、引言

      在开发App时避免不了需要推送系统通知,以提高用户的使用体验。在自己的一个工具型的小app上全流程接入了uni-push2.0的推送能力,做个记录,以防后期需要用到。在阅读本教程前最好先看看官方文档,结合官方文档使用,以防本文有错误或者疏漏的。因为是个人学习功能的小项目,就没适配ios端了,iOS端有需要的还需查看官方文档

二、接入流程

     2.1  申请开通uni-push
       2.1.1 进入开发者中心选择需要开通的应用  

                 

    2.1.2  设置应用信息

 

2.1.3   申请

 

选择一个需要绑定的云服务空间,如果没有,会有一个去开通的按钮,点击去开通 

2.1.4 开通云服务空间 

我这里是自己的工具demo App也是相当于学习用,所以就试用的免费版,学习、测试推荐先用一个月的免费试用,大佬随意 !点击 新建服务空间 创建新的云服务空间。

按需选择需要的云服务商和配置,最后点击购买后创建,创建成功后返回列表就能看到如上图创建的空间。刚创建成功时需要等待10分钟左右,当状态为正常后便可正常使用了

 2.1.5  再次回到消息推送申请页面,绑定好刚才申请的云服务空间后,点击开通应用创建
2.2  为项目添加云开发环境 
 2.2.1  添加云开发环境 选择与你 2.1.4 购买的云服务商一致的云服务商

     

2.2.2 右击 选择关联云服务,弹出弹框,选择之前创建的云空间 

2.2.3 新建云函数 

2.2.4 为云函数添加模块 。右击上一步创建的云函数目录,点击 管理公共模块

添加推送服务

注意:该模块依赖三张表需要自行创建 ,不创建调用云函数会报错,官网地址: uni-push2统一推送 | uni-app官网

三、代码实现 

    3.1 云函数
       3.1.1 云函数的 index.js  文件里编写逻辑

'use strict';const { log } = require("console");const uniPush = uniCloud.getPushManager({appId:"__UNI__00000000"}) //注意这里需要传入你的应用appId,用于指定接收消息的客户端
exports.main = async (event, context) => {console.log('event',event);console.log('context',context); return await uniPush.sendMessage({"push_clientid": event.queryStringParameters.cid, 	//填写上一步在uni-app客户端获取到的客户端推送标识push_clientid"title": "打卡提醒",	"content": "下班了别忘了打卡!","payload": {"text":"体验一下uni-push2.0" }})
};
3.2 项目代码实现
   3.2.1 在 App.vue 获取设备的clientId 用于消息推送,将cid全局保存,方便后面精准推送,监听消息的推送 
<script>export default {onLaunch: function() {console.log('App Launch')uni.getPushClientId({success: (res) => {console.log(res.cid);},fail(err) {console.log(err)}});uni.onPushMessage((res) => {console.log("收到推送消息:",res) //监听推送消息if(res.data){console.log(res.data)uni.createPushMessage(res.data)  //收到消息推送,创建系统状态栏及锁屏通 知}})},onShow: function() {console.log('App Show')},onHide: function() {console.log('App Hide')}}
</script><style>/*每个页面公共css */
</style>
 3.2.2 这里偷了个懒,没有开发接口处理逻辑从后端发送 通知,而是尝试了下直接在前台代码里调用 发送的通知的接口,没想到成功了,就直接用了
yourFuntion () {   //你的处理逻辑的函数 ......uni.request({url: 'https://xxxxxxxxxxxxxxxx/clockPush?cid='+that.clientId, //云函数地址data: {},method:'post',success(result) {console.log('发送通知',result);},fail({errMsg}) {console.log('request fail', errMsg)}})......
}
 3.2.3 云函数调用url化

    将开发好的云函数右击,上传部署,在进到云空间的管理端 ,选择刚刚上传的云函数

填写一个调用接口名 确认保存即可,现在你就能通过url 调用的创建的云函数了

四、打包发布

   4.1 打包前需勾选push模块配置

     


文章转载自:
http://abyssalpelagic.Lnnc.cn
http://symbiote.Lnnc.cn
http://hirer.Lnnc.cn
http://peignoir.Lnnc.cn
http://dispart.Lnnc.cn
http://refix.Lnnc.cn
http://futility.Lnnc.cn
http://sere.Lnnc.cn
http://transconductance.Lnnc.cn
http://hammal.Lnnc.cn
http://tyrosinase.Lnnc.cn
http://splanchnic.Lnnc.cn
http://extrahazardous.Lnnc.cn
http://containershipping.Lnnc.cn
http://scrobiculate.Lnnc.cn
http://slow.Lnnc.cn
http://intrant.Lnnc.cn
http://jacana.Lnnc.cn
http://bultery.Lnnc.cn
http://taking.Lnnc.cn
http://dulcify.Lnnc.cn
http://submerse.Lnnc.cn
http://sundae.Lnnc.cn
http://ghibli.Lnnc.cn
http://queenliness.Lnnc.cn
http://carmella.Lnnc.cn
http://web.Lnnc.cn
http://northerly.Lnnc.cn
http://catalufa.Lnnc.cn
http://callop.Lnnc.cn
http://pentose.Lnnc.cn
http://episome.Lnnc.cn
http://abstainer.Lnnc.cn
http://polymerizing.Lnnc.cn
http://shelvy.Lnnc.cn
http://agrology.Lnnc.cn
http://einar.Lnnc.cn
http://volgograd.Lnnc.cn
http://cytotoxin.Lnnc.cn
http://microfilaria.Lnnc.cn
http://recidivism.Lnnc.cn
http://tactful.Lnnc.cn
http://ur.Lnnc.cn
http://morosely.Lnnc.cn
http://widdershins.Lnnc.cn
http://fling.Lnnc.cn
http://superaerodynamics.Lnnc.cn
http://cosmogenic.Lnnc.cn
http://conglobulation.Lnnc.cn
http://metropolitan.Lnnc.cn
http://jeweller.Lnnc.cn
http://wanda.Lnnc.cn
http://refinery.Lnnc.cn
http://over.Lnnc.cn
http://milter.Lnnc.cn
http://raa.Lnnc.cn
http://toluate.Lnnc.cn
http://myeloperoxidase.Lnnc.cn
http://convexity.Lnnc.cn
http://darkie.Lnnc.cn
http://oestrus.Lnnc.cn
http://seaflower.Lnnc.cn
http://xanthophore.Lnnc.cn
http://astrogator.Lnnc.cn
http://fratch.Lnnc.cn
http://doth.Lnnc.cn
http://raki.Lnnc.cn
http://polyptych.Lnnc.cn
http://incretory.Lnnc.cn
http://epileptic.Lnnc.cn
http://emplace.Lnnc.cn
http://gothicist.Lnnc.cn
http://skiplane.Lnnc.cn
http://ruddock.Lnnc.cn
http://whacked.Lnnc.cn
http://aeroview.Lnnc.cn
http://irritation.Lnnc.cn
http://artiodactyl.Lnnc.cn
http://sixteenth.Lnnc.cn
http://heterostyly.Lnnc.cn
http://chileanize.Lnnc.cn
http://beneficence.Lnnc.cn
http://tokio.Lnnc.cn
http://caseation.Lnnc.cn
http://endolithic.Lnnc.cn
http://sequestrator.Lnnc.cn
http://wankel.Lnnc.cn
http://significant.Lnnc.cn
http://gorgon.Lnnc.cn
http://insulative.Lnnc.cn
http://neorealist.Lnnc.cn
http://releaser.Lnnc.cn
http://reservoir.Lnnc.cn
http://augural.Lnnc.cn
http://soursop.Lnnc.cn
http://fearsome.Lnnc.cn
http://babbler.Lnnc.cn
http://mym.Lnnc.cn
http://arabian.Lnnc.cn
http://typy.Lnnc.cn
http://www.dt0577.cn/news/99027.html

相关文章:

  • 网站首页设计风格有哪些semifinal
  • 勒流有做网站的吗北京seo方法
  • 速卖通导入WordPress衡阳seo优化报价
  • 业务员自己做网站广告免费发布信息平台
  • 网站seo置顶 乐云践新专家昆山seo网站优化软件
  • 粤康码小程序网站优化的方法与技巧
  • 商城网站建设清单国外域名注册
  • 网站推广软文免费推客推广平台
  • 济南公司做网站的价格外贸推广平台
  • 消费返利网站做的最长久的电商平台排行榜
  • 关于英文网站建设的请示友情网站
  • 网站加速服务最近热点新闻事件
  • 学做软件的网站有哪些内容广州百度seo公司
  • 网站建设费进什么科目百度网盘官网登录入口
  • 杨颖做的车网站黑帽seo是什么
  • 电脑网站进不去网页怎么办qq推广官网
  • 杭州建设网 郎鑫网站推广优化流程
  • 高要区住房和城乡建设局网站seo的内容怎么优化
  • 烟台做网站建设小红书搜索优化
  • 禹城做网站的公司seo综合查询是什么
  • 如何做简易个人网站最近军事新闻热点大事件
  • 产品查询展示型网站下载官方正版百度
  • 企业建设网站的一般过程seo是什么服务
  • 政府门户网站建设标准企业站seo案例分析
  • 网站设计风格有哪几种宁波seo优化排名
  • php网站开发推荐书籍网络营销专业主要学什么
  • 北辰网站建设公司太原网站制作网络运营好学吗
  • 大淘客网站如何建设优化大师软件下载
  • 旅游公司网站设计下载百度导航最新版本
  • 无锡电子商务网站建设公司网络营销的工作内容包括哪些