RN 集成极光推送 jpush-react-native
发布日期:2021-10-16 12:04:59 浏览次数:27 分类:技术文章

本文共 1029 字,大约阅读时间需要 3 分钟。

jpush-react-native —-是极光推送官方开发的 React Native 版本插件,可以快速集成推送功能。

import JPushModule from 'jpush-react-native';if (Platform.OS === 'android') {// 通知 JPushModule 初始化完成,发送缓存事件。     JPushModule.notifyJSDidLoad((resultCode) => {     });}// 接收自定义消息事件JPushModule.addReceiveCustomMsgListener((message) => {    console.log("用户点击打开了,removeReceiveCustomMsgListener");});// 接收推送事件JPushModule.addReceiveNotificationListener((message) => {    console.log("next removeReceiveNotificationListener: " + message);    DeviceEventEmitter.emit('hasNewNotice', '通知来了');});// 点击推送事件,打开通知JPushModule.addReceiveOpenNotificationListener((map) => {   console.log("next removeReceiveOpenNotificationListener ,map.extra: " + map.extras);   // 可执行跳转操作,也可跳转原生页面   // this.props.navigation.navigate("SecondActivity");});//移除监听消息通知removeReceivedJPush() {   JPushModule.removeReceiveCustomMsgListener();   JPushModule.removeReceiveNotificationListener();   JPushModule.removeReceiveOpenNotificationListener();   // 清除所有通知   JPushModule.clearAllNotifications()}

参考地址:

转载地址:https://blog.csdn.net/snow51/article/details/80843409 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:RN 组件 Linking
下一篇:RN 组件 DeviceEventEmitter 发送和接收事件

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2024年04月01日 18时20分58秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

spring boot 与 Ant Design of Vue 实现左侧组织树(二十三) 2019-04-27
spring boot 与 Ant Design of Vue 实现新增组织(二十四) 2019-04-27
spring boot 与 Ant Design of Vue 实现修改组织(二十五) 2019-04-27
spring boot 与 Ant Design of Vue 实现删除组织(二十六) 2019-04-27
spring boot 与 Ant Design of Vue 实现获取用户列表(二十七) 2019-04-27
spring boot 与 Ant Design of Vue 实现新增用户(二十八) 2019-04-27
spring boot 与 Ant Design of Vue 实现修改用户(二十九) 2019-04-27
spring boot 与 Ant Design of Vue 实现删除用户(三十) 2019-04-27
spring boot 与 Ant Design of Vue 鉴权体系登录的实现(三十一) 2019-04-27
spring boot 与 Ant Design of Vue 鉴权体系获取用户信息的实现(三十二) 2019-04-27
Druid连接池实现自定义场景的多数据库的连接 2019-04-27
CentOs7命令行(静默)的方式安装oracle数据库 2019-04-27
基于VMware安装CentOs7的镜像 2019-04-27
PL/SQL数据库管理工具的使用 2019-04-27
史上最简单的spring-boot集成websocket的实现方式 2019-04-27
带你玩转属于自己的spring-boot-starter系列(一) 2019-04-27
带你玩转属于自己自己的spring-boot-starter系列(二) 2019-04-27
带你玩转属于自己的spring-boot-starter系列(三) 2019-04-27
基于SnowFlake算法如何让分库分表中不同的ID落在同一个库的算法的实现 2019-04-27
基于springboot的ShardingSphere5.X的分库分表的解决方案之分库解决方案(二) 2019-04-27