{"id":20160575,"url":"https://github.com/reactnativecn/react-native-jpush","last_synced_at":"2025-08-25T08:07:39.863Z","repository":{"id":57337870,"uuid":"49472218","full_name":"reactnativecn/react-native-jpush","owner":"reactnativecn","description":null,"archived":false,"fork":false,"pushed_at":"2016-12-21T02:41:16.000Z","size":6833,"stargazers_count":124,"open_issues_count":18,"forks_count":20,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-24T01:51:12.747Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reactnativecn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-12T03:26:39.000Z","updated_at":"2023-08-08T15:29:55.000Z","dependencies_parsed_at":"2022-09-03T08:00:40.592Z","dependency_job_id":null,"html_url":"https://github.com/reactnativecn/react-native-jpush","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactnativecn%2Freact-native-jpush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactnativecn%2Freact-native-jpush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactnativecn%2Freact-native-jpush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactnativecn%2Freact-native-jpush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reactnativecn","download_url":"https://codeload.github.com/reactnativecn/react-native-jpush/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657281,"owners_count":20974345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T00:14:47.014Z","updated_at":"2025-04-10T00:10:31.566Z","avatar_url":"https://github.com/reactnativecn.png","language":"Objective-C","readme":"# react-native-jpush\n\n# 现推荐使用极光官方维护的推送插件[jpush-react-native](https://github.com/jpush/jpush-react-native)\n\nReact Native的极光推送插件, react-native版本需要0.17.0及以上\n\n## 如何安装\n\n### 首先安装npm包\n\n```bash\nnpm install react-native-jpush --save\n```\n\n### link\n```bash\nrnpm link react-native-jpush\n```\n\n#### Note: \n* rnpm requires node version 4.1 or higher\n* Android SDK Build-tools 23.0.2 or higher\n\n\n### iOS工程配置\na.在工程target的`Build Phases-\u003eLink Binary with Libraries`中加入`libz.tbd、CoreTelephony.framework、Security.framework`\n\nb.在你的工程中创建一个新的Property List文件，并将其命名为PushConfig.plist，文件所含字段如下：\n\n```\nCHANNEL\n\t指明应用程序包的下载渠道，为方便分渠道统计，具体值由你自行定义，如：App Store。\nAPP_KEY\n\t与JPush上申请的 AppKey 一致。\nAPS_FOR_PRODUCTION\n\t0 (默认值)表示采用的是开发证书，1 表示采用生产证书发布应用。\n\t注：此字段的值要与Build Settings的Code Signing配置的证书环境一致。\n```\nc.在`AppDelegate.m`中加入\n\n```\n#import \"RCTJPush.h\"\n\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n  ...\n  \n  [RCTJPush application:application didFinishLaunchingWithOptions:launchOptions];\n  \n  ...\n}\n\n- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken\n{\n  [RCTJPush application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n}\n\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification\n{\n  [RCTJPush application:application didReceiveRemoteNotification:notification];\n}\n\n- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {\n  [RCTJPush application:application didReceiveRemoteNotification:notification];\n  completionHandler(UIBackgroundFetchResultNewData);\n}\n```\n\n### Android配置\n\n在`android/app/build.gradle`里，defaultConfig栏目下添加如下代码：\n\n```\nmanifestPlaceholders = [\n    JPush_APPID: \"JPush的APPID\",\t//在此修改JPush的APPID\n    APP_CHANNEL: \"应用渠道号\"\t\t//应用渠道号\n]\n```\n\n## 如何使用\n\n### 引入包\n\n```\nimport JPush , {JpushEventReceiveMessage, JpushEventOpenMessage} from 'react-native-jpush'\n```\n\n在你的根Component中加入下面代码\n\n```\ncomponentDidMount() {\n    JPush.requestPermissions()\n    this.pushlisteners = [\n        JPush.addEventListener(JpushEventReceiveMessage, this.onReceiveMessage.bind(this)),\n        JPush.addEventListener(JpushEventOpenMessage, this.onOpenMessage.bind(this)),\n    ]\n}\ncomponentWillUnmount() {\n    this.pushlisteners.forEach(listener=\u003e {\n        JPush.removeEventListener(listener);\n    });\n}\nonReceiveMessage(message) {\n}\nonOpenMessage(message) {\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactnativecn%2Freact-native-jpush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactnativecn%2Freact-native-jpush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactnativecn%2Freact-native-jpush/lists"}