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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-gysdk

v1.0.6

Published

Getui gy sdk plugin for react-native

Readme

react-native-gysdk

react-native-gysdk 是个推官方开发的 React Native 插件,用于快速集成推送功能,助力开发者高效实现消息推送服务。


环境要求

  • React Native 版本:
    • react: 18.3.1
    • react-native: 0.75.4
  • 插件版本: react-native-gysdk 1.0.6

注意:

  • 请确保项目环境与上述版本兼容。
  • 部分功能在 Android 和 iOS 平台上的 API 实现有所不同,请参考 index.jsindex.d.ts 中的 API 注释。

1. 安装

1.1 自动安装

在项目根目录下执行以下命令:

# 步骤 1:添加 npm 包依赖
npm install react-native-gysdk@latest --save

# 步骤 2:链接 iOS 原生代码(适用于 iOS Pod 项目)
npx pod-install

# 步骤 2:链接(适用于非 Autolinking 项目或 iOS 非 Pod 项目)
react-native link

1.2 示例代码

查看完整示例代码:


2. 配置

2.1 获取 App ID

访问 个推官网 注册并在后台获取 appId

2.2 Android 配置

2.2.1 AndroidManifest.xml

AndroidManifest.xml<application> 节点中添加以下配置:

<manifest>
  <application>
    <meta-data android:name="GETUI_APPID" android:value="你的appid"/>
    <meta-data android:name="GT_INSTALL_CHANNEL" android:value=""/>
  </application>
</manifest>

2.2.2 app/build.gradle

配置签名信息,确保调试和发布版本的签名正确:

signingConfigs {
  debug {
    storeFile file('debug.keystore')
    storePassword 'android'
    keyAlias 'androiddebugkey'
    keyPassword 'android'
  }
}
buildTypes {
  debug {
    signingConfig signingConfigs.debug
  }
  release {
    // 配置 release 签名
  }
}

2.2.3 混淆配置

如果启用 ProGuard 混淆,请在 proguard-rules.pro 中添加以下规则:

# 移动 SDK (5.9.1)
-dontwarn com.cmic.sso.sdk.**
-keep class com.cmic.sso.sdk.** {*;}
# 移动 SDK (5.9.3,包名变更)
-dontwarn com.cmic.gen.sdk.**
-keep class com.cmic.gen.sdk.** {*;}
# 电信 SDK
-dontwarn cn.com.chinatelecom.**
-keep class cn.com.chinatelecom.** {*;}
# 联通在线
-dontwarn com.unicom.online.account.shield.**
-keep class com.unicom.online.account.shield.** {*;}
-keep public class android.net.GyConnectivityManager {public *;}
# 个验 SDK
-dontwarn com.g.gysdk.**
-keep class com.g.gysdk.** {*;}
# 联通相关
-keep class com.unicom.online.account.kernel.** {*;}
-dontwarn org.bouncycastle.**
-keep class org.bouncycastle.** {*;}
# 个推 GTC
-keep class com.getui.gtc.** {*;}
-keepattributes Signature, InnerClasses, EnclosingMethod, Exceptions, *Annotation*
-keep class com.getui.gtc.dyc.** {*;}
-keep class com.getui.gtc.dim.** {*;}
-keep class com.getui.gtc.base.** {*;}
-keep class com.igexin.base.** {*;}

2.3 iOS 配置

2.3.1 使用 CocoaPods 安装

如果你的 React Native 项目通过 CocoaPods 集成,请按照以下步骤操作:

  1. Podfile 的对应 target 中添加以下代码:

    pod 'GySdkRN', :path => '../node_modules/react-native-gysdk'
  2. 在终端执行以下命令:

    pod install

注意

  • 使用 CocoaPods 安装时,不要运行 react-native link,否则可能导致冲突。
  • 如果在 iOS 工程中找不到头文件,请在 TARGETS -> Build Settings -> Search Paths -> Header Search Paths 中添加以下路径:
    $(SRCROOT)/../node_modules/react-native-gysdk/ios/RCTGetuiModule

3. API 调用与消息订阅

  • Android 和 iOS 平台的 API 实现存在差异,请参考 index.jsindex.d.ts 中的 API 注释。
  • 示例代码:

4. iOS 注意事项

  • 确保正确配置 CocoaPods,避免与 react-native link 冲突。
  • 检查头文件路径设置,确保编译时能正确找到插件的头文件。

5. 常见问题

  • 问题:Android 混淆后应用崩溃?
    • 解决:检查 proguard-rules.pro 是否包含所有必要的混淆规则。
  • 问题:iOS 编译时找不到头文件?
    • 解决:在 Xcode 的 Header Search Paths 中添加插件路径。
  • 问题:API 调用无响应?
    • 解决:检查 appId 是否正确配置,并确保已调用 startSdk 初始化。

6. 支持

如需进一步帮助,请访问 个推官网 或联系技术支持。