jpush / jpush-react-native Goto Github PK
View Code? Open in Web Editor NEWJPush's officially supported React Native plugin (Android & iOS). 极光推送官方支持的 React Native 插件(Android & iOS)。
Home Page: http://docs.jiguang.cn
License: MIT License
JPush's officially supported React Native plugin (Android & iOS). 极光推送官方支持的 React Native 插件(Android & iOS)。
Home Page: http://docs.jiguang.cn
License: MIT License
例如在推送时选择badge +1, 那么点击通知之后,如何实现badge -1 ?
好像在文档中没有找到getBadge等类似方法?
通知推送接受到的内容是正常的,自定义的消息接收到是一个空对象,怎么解决?
正常的是应该每接受到一次推送角标就自动+1的吧
iOS10 貌似无法收到推送通知
在应用退出后,点击通知可以打开应用,但是通知的参数应该怎样传递进入RN呢?
使用react的绝大部分是不懂ios或安卓的,我觉得您应该脱离jush文档,自己重新详细定义一份文档。
到底哪些必须配置,哪些不用配置,而不是一个链接;
仅是建议,望参考。
iOS10 貌似无法收到推送通知
这个插件按照说明,没有运行起来,整个Android的目录结构和官方例子不同的地方太多,上手有点难。希望能跟官方例子的目录结构保持一致,并给出详细的说明,谢谢。
现在的Apikey的配置是在 jpush-react-plugin 的build.gradle文件里面,
但是这个文件 是在 node_modules 目录里面的,显然是不在git里面的。
如果有多个人开发这个同一个项目的话,那他把项目clone到本地之后,还需要手动去修改这些东西,才能生效。如果他忘记了,或者不知道的还,那不就坑爹了。
建议把这个东西 弄到 MainActivity 里面去。
是不是在JPUSHService.h文件中,缺少了此定义?
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// 取得 APNs 标准信息内容
[[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo];
}
//iOS 7 Remote Notification
- (void)application:(UIApplication *)application didReceiveRemoteNotification: (NSDictionary *)userInfo fetchCompletionHandler:(void (^) (UIBackgroundFetchResult))completionHandler {
[[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo];
}
在杀死应用进程后,当再次打开应用时,怎么判断是点击通知方式进入的的还是点击应用图标方式进入的,JS中有没有什么参数或方法可以判断的
iOS设备在接收到一条推送通知时多次重复运行NativeAppEventEmitter.addListener('ReceiveNotification', (notification)=>{console.log("推送通知");console.log(notification);})(Android端那三个函数没问题)
而我希望的是接收到一条推送消息就运行一次NativeAppEventEmitter.addListener('ReceiveNotification', (notification)=>{console.log("推送通知");console.log(notification);})
这算BUG吗
首先,感谢提供这个组件!!!
import JPushModule from 'jpush-react-native';
......... //其他代码
JPushModule.setAlias('283', ()=> {
console.log('-------success---------');
}, ()=> {
console.log('-------fail---------');
});
"react": "15.2.1",
"react-native": "0.31.0",
"jpush-react-native": "^1.1.3",
已按照要求配置,提示 init success后,提示 'Error Code 6003'. 请问什么原因?
如题
是不是也可以把npm包对应的repo放到github上啊, 这样可以接受社区各种PRs改进
看了一下这个插件,感觉要集成非常不方便,如果我是要集成到我现有的项目要怎么做,不是使用这个APP 目录
请问 我完全按照ReadMe重新配置好后,现在可以发送推送消息,但是仍然无法接受到消息,而且registrationid也没有
每次点击GET REGISTRATIONID 后 registrationid都变为null,请问能帮忙看下么 @KenChoi1992
我的项目是以前下载,如果在Android5.0真机运行需要把
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
1.3.1 => 1.2.0 不然是运行不起来的,但是加了jpush插件后,一开始我没改版本号(1.3.1)在模拟器上运行一切正常,但是当我要到真机运行时,并把版本号换成(1.2.0),项目能正常运行,但是发送通知后接受不到RegistrationId,也接受不到推送消息,请问这是什么原因啊? @
点击推送的富媒体弹窗类型信息,未显示弹窗。只能收到回调中推送的文本内容。
其他几类都可以正常打开:landing page、URL、信息流。
Hi,
I want to show the disallow allow push notification dialog
more later than app launches(didFinishLaunchingWithOptions).
In here, the document recommended to call that method in didFinishLaunchingWithOptions callback.
But can i call this when i want? Is there a javascript exported method?
I have analysed some of your lib code, and found that,
jpush-react-native/ios/RCTJPushModule/RCTJPushModule/RCTJPushModule.m
LIne #59
//RCT_EXPORT_METHOD(setupPush:(NSString *)name) {
// if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {
// //可以添加自定义categories
// [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |
// UIUserNotificationTypeSound |
// UIUserNotificationTypeAlert)
// categories:nil];
// } else {
// //categories 必须为nil
// [JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
// UIRemoteNotificationTypeSound |
// UIRemoteNotificationTypeAlert)
// categories:nil];
// }
//
// [JPUSHService setupWithOption:nil appKey:appKey
// channel:channel apsForProduction:isProduction];
//}
this code is commented.
Can i uncomment this, and use this method? Is there a side-effect that I have to concern?
为什么安卓照着文档配置后,StopPush,ResumePush都提示Success,但是GetRegistrationID找不到,并且调试时返回-996错误,但是设备是联网的,并且核对了包名申请的APPKey应该没错。
@KenChoi1992 我之前有关注到你的另一个项目 https://github.com/KenChoi1992/react-native-jpush-plugin 我看到你最近也在更新另一个项目,请问这两个我应该用哪一个?他们有什么差别?
/**
* rn 0.29.0 以下版本,请使用此方法,并去掉 MainApplication 文件, 0.29.0 以上版本请去掉这些注释代码
* 注意改变其中的 JSMainModuleName 的路径(因为此版本适配了 rn 0.30.0, index.android.js 放在了项目目录下)
* 相应地,index.android.js 中 push_activity.js,set_activity.js的引用路径也要改变(参考 index.android.js)
*/
// private ReactRootView mReactRootView;
// private ReactInstanceManager mReactInstanceManager;
// private boolean SHUTDOWN_TOAST = false;
// private boolean SHUTDOWN_LOG = false;
// @OverRide
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// mReactRootView = new ReactRootView(this);
// mReactInstanceManager = ReactInstanceManager.builder()
// .setApplication(getApplication())
// .setBundleAssetName("index.android.bundle")
// .setJSMainModuleName("react-native-android/index.android")
// .addPackage(new MainReactPackage())
// .addPackage(new JPushPackage(SHUTDOWN_TOAST, SHUTDOWN_LOG))
// .setUseDeveloperSupport(BuildConfig.DEBUG)
// .setInitialLifecycleState(LifecycleState.RESUMED)
// .build();
// mReactRootView.startReactApplication(mReactInstanceManager, "PushDemoApp", null);
//
// setContentView(mReactRootView);
// }
这里的意思是如果>0.30,uncomment掉这段代码?setJSMainModuleName应该设置自己项目的index?
1、应用进入后台后,收到通知点击无法切换到前台的可能原因
2、杀死应用进程后,无法再收到通知的可能原因
【ios下无法接收到推送消息】配置成功,deviceToken已经成功推上服务器,推送页面也能正常检测到设备。
请问这可能是什么原因导致的呢?
设备:
ipod touch
ios v8.4
为什么Android推送的只能接收到Message,接收不到额外加入的键值对
已经在安装中心设置了自启动省电管理也让APP不被清除了 然而 推送服务依然不能自启
ReactNative: v0.29
模拟器
android: v4.4.4
推送通知可以正常到达. 如果应用已经打开(不管是前台还是后台), 点击通知栏的通知, 会重新打开一个"实例"(不确定是不是打开了一个新的Activity还是其他什么, 安卓这个我也不是很懂). 这个实例可以通过Back键退出, 退出后就到了原来打开的界面里了.
请问是否哪里配置不对?
调用initPush后, 会有这个toast提示, 是不是可以注释掉呢? 或者加个选项?
运行项目后角标一直是1,不管推送多少条都没有变化;当我在AppDelegate.m添加了
-(void)applicationDidEnterBackground:(UIApplication *)application {
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; //0 设置为0 ,可以设置为任意的值
}
方法后,还是没有实现:每推送一下消息角标加一,每点击一下图标,角标减一的效果。
请问这个效果在ios怎么实现? @
推送几条消息后经常发现服务器端发出的消息和手机端角标经常对应不起来,不知道怎么实现服务器端badge和手机端角标保持一致?能详细说明下么?
我的APP Home页可以收到推送 一但切换到另外一个页面就会收不到推送了 只有重启APP才能收到之前的推送消息
@KenChoi1992 你好,我试了下新版本还是有些问题:
把下面代码改成老版本,可以把后台应用切换到前台
// v0.1.1 版本
Logger.d(TAG, "用户点击打开了通知");
WritableMap map = Arguments.fromBundle(bundle);
mRAC.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("openNotification", map);
Intent intent = new Intent();
if (mModule != null && mModule.getCurrentActivity() != null) {
intent.setClass(context, mModule.getCurrentActivity().getClass());
Logger.d(TAG, "context.getClass: " + mModule.getCurrentActivity().getClass());
intent.putExtras(bundle);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
旧版本可以把应用切换到前台显示
v0.1.0
Logger.d(TAG, "用户点击打开了通知");
WritableMap map = Arguments.fromBundle(bundle);
mRAC.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("openNotification", map);
Intent intent = new Intent();
if (mModule != null && mModule.mContext != null) {
intent.setClass(context, mModule.mContext.getClass());
intent.putExtras(bundle);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
如何实现当点击通知的时候,切换后台已存在的应用到前台展示?
虽然你们是官方维护的jpush,但是文档跟 reactnativecn的那个比真的差挺远的。不过貌似你们用的API比较新。
用react native的大部分都是前端程序员(说的就是我),一些涉及到原生应用的配置,看着都很头疼,有时候会被一些原生应用的基本概念挡在门外。
能花点时间整理一下文档不,尽可能写详细一点。
我是通过长按home清除任务发现这个错误的。正常退出没有这个错误。
之前尝试使用过另一款推送服务,也是有这个错误。
清除任务后,收到通知,会报一个错误。
点击通知也会报一个错误。
然后再推送就收不到通知了。
如果再打开应用的话,就会收到之前未收到的通知。
错误日志在下面
NativeAppEventEmitter.addListener(
'ReceiveNotification',
(notification) => console.log(notification)
);
这段代码无效果
已经添加了
为了在收到推送点击进入应用能够获取该条推送内容需要在 AppDelegate.m didReceiveRemoteNotification 方法里面添加 [[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo] 方法
Android 的推送有延迟的,延迟时间不等,最后全部收到了,麻烦问下可以优化吗?谢谢
duplicate symbol _kJPFServiceErrorNotification in: /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPushModule.a(JPUSHService.o) /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPush.a(APService.o) duplicate symbol _kJPFNetworkDidRegisterNotification in: /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPushModule.a(JPUSHService.o) /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPush.a(APService.o) duplicate symbol _kJPFNetworkDidSetupNotification in: /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPushModule.a(JPUSHService.o) /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPush.a(APService.o) duplicate symbol _kJPFNetworkDidLoginNotification in: /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPushModule.a(JPUSHService.o) /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPush.a(APService.o) duplicate symbol _kJPFNetworkDidCloseNotification in: /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPushModule.a(JPUSHService.o) /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPush.a(APService.o) duplicate symbol _kJPFNetworkDidReceiveMessageNotification in: /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPushModule.a(JPUSHService.o) /Users/yangguobao/Library/Developer/Xcode/DerivedData/ListenerApp-fkckisnbhcqpsreucevpueraijvi/Build/Products/Debug-iphonesimulator/libRCTJPush.a(APService.o) ld: 6 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
错误如图,请问是什么原因?
node_modules可能会被删除,导致配置失效
我不懂安卓开发 是否有方法放在ios类似AppDelegate中 这样似乎比较好
安卓按文档配置后,能拿到注册ID,推送后台也显示推送成功,但是手机端消息接受不到,后台目标|成功一直是1|0,还一直有推送提示,“Jpush提示:缺少统计代码 检测到集成SDK未添加统计代码”。
ios版本怎么没有点击通知的回调监听?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.