npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-jpush-notify

v2.5.3

Published

a jpush plugin for react native application

Downloads

3

Readme

tag QQ Group

JPush React Native Plugin

English Document

注意:

  • jpush-react-native 自 1.4.4 之后, 需要安装 jcore-react-native
  • 安装完后,需要执行 react-native link。如果出错了,无需惊慌,手动配置一下即可,具体可参考这篇文章

安装

npm install react-native-jpush-notify jcore-react-native --save

配置

配置包括两个步骤,自动配置和手动操作。

1.自动配置部分(以下命令均在你的 React Native Project 目录下运行)

如果工程不是通过 Cocoapods 来集成 ReactNative 的可以直接使用下面代码来 link 插件。

react-native link

根据提示,输入 appKey 等即可。

自动配置操作会自动插入 Native 代码(iOS 中使用 Appdelegate.m 文件名,如果修改了该文件名需要手动插入代码),这个部分用户无需关系具体细节。

(如果是原生应用集成 react-native)使用 CocoaPods 安装
如果你的 React Native 是通过 Cocoapods 来集成的则使用下面两个步骤来集成,注意: 使用 pod 就不要使用 react-native link 了,不然会有冲突。
  1. 在 Podfile 中添加如下代码:
pod 'JPushRN', :path => '../node_modules/react-native-jpush-notify'
  1. 终端执行如下指令:
pod install

2.手动操作部分(自动配置后,部分操作需要手动修改)

iOS 手动操作部分 (3 个步骤)

  • 在 iOS 工程中设置 TARGETS-> BUILD Phases -> LinkBinary with Libraries 找到 UserNotifications.framework 把 status 设为 optional

  • 在 iOS 工程中如果找不到头文件可能要在 TARGETS-> BUILD SETTINGS -> Search Paths -> Header Search Paths 添加如下路径

$(SRCROOT)/../node_modules/react-native-jpush-notify/ios/RCTJPushModule
  • 在 xcode8 之后需要点开推送选项: TARGETS -> Capabilities -> Push Notification 设为 on 状态

Android 手动操作部分 (3 个步骤)

  • 修改 app 下的 build.gradle 配置:

your react native project/android/app/build.gradle

android {
    defaultConfig {
        applicationId "yourApplicationId"
        ...
        manifestPlaceholders = [
                JPUSH_APPKEY: "yourAppKey", //在此替换你的APPKey
                APP_CHANNEL: "developer-default"    //应用渠道号
        ]
    }
}
...
dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation project(':react-native-jpush-notify')  // 添加 jpush 依赖
    implementation project(':jcore-react-native')  // 添加 jcore 依赖
    implementation "com.facebook.react:react-native:+"  // From node_modules
}

将此处的 yourApplicationId 替换为你的项目的包名;yourAppKey 替换成你在官网上申请的应用的 AppKey。

API

Android v1.6.6 版本后新增 notifyJSDidLoad,请务必在接收事件之前调用此方法。

关于点击通知跳转到指定界面

  • Android v1.6.7 新增 API jumpToPushActivity,使用参考 demo

常见问题


贡献者列表