Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
react-native-tim-push
Advanced tools
The react-native-tim-push
plugin is a RN plugin that enables developers to integrate push
notifications for their RN applications. This plugin supports both iOS and Android platforms
and allows for seamless integration with various native push notification providers, such as Huawei,
Xiaomi, OPPO, Vivo, Honor, Meizu, and Google Firebase Cloud Messaging (FCM).
To add the react-native-tim-push
plugin to your RN project, include it as a dependency in
your package.json
file or run the following command:
npm install react-native-tim-push
//or
yarn add react-native-tim-push
Upload your iOS APNs push certificate to the IM console and obtain the certificate ID. Call
the TimPushPlugin.getInstance().setApnsCertificateID
method as early as possible in your app's
lifecycle and pass in the certificate ID:
TimPushPlugin.getInstance().setApnsCertificateID(CertificateID);
After completing the push notification provider configuration in the console, download
the timpush-configs.json
file and add it to the android/app/src/main/assets
directory of your
project. If the directory does not exist, create it manually.
In this step, you will need to write some native code, such as Swift, Java. Follow the instructions provided and copy the provided code snippets to the specified files.
TencentIMPush.swift
in the ios directory.TencentIMPush.swift
file.import Foundation
import react_native_tim_push
@objc class TencentImPush: NSObject{
@objc func getOfflinePushCertificatedID() -> Int32 {
return TencentCloudPushModal.shared.offlinePushCertificateID();
}
@objc func getApplicationGroupID() -> String {
return TencentCloudPushModal.shared.applicationGroupID();
}
@objc func onRemoteNotificationReceived(_ notice: String?) -> Void {
TencentCloudPushModal.shared.onRemoteNotificationReceived(notice);
}
}
AppDelegate.h
.#import <Your-Project-Name-Swift.h>
// My project Name is `TimPushExample`. So it should be `#import <Your-Project-Name-Swift.h>`
AppDelegate.mm
.- (int)offlinePushCertificateID {
TencentImPush *instance = [[TencentImPush alloc] init];
return [instance getOfflinePushCertificatedID];
}
- (NSString *)applicationGroupID {
TencentImPush *instance = [[TencentImPush alloc] init];
return [instance getApplicationGroupID];
}
- (BOOL)onRemoteNotificationReceived:(NSString *)notice {
TencentImPush *instance = [[TencentImPush alloc] init];
[instance onRemoteNotificationReceived:notice];
return YES;
}
In MainApplication.kt
, import com.timpush.RNTencentIMPushApplication
and replace "Application"
with "RNTencentIMPushApplication"
.
No additional configuration is required for iOS in this step.
Open the android/app/build.gradle
file and add the dependencies for the push notification
providers you want to support. You can include all or some of the providers listed below:
dependencies {
// Huawei
implementation 'com.tencent.timpush:huawei:7.7.5283'
// XiaoMi
implementation 'com.tencent.timpush:xiaomi:7.7.5283'
// OPPO
implementation 'com.tencent.timpush:oppo:7.7.5283'
// vivo
implementation 'com.tencent.timpush:vivo:7.7.5283'
// Honor
implementation 'com.tencent.timpush:honor:7.7.5283'
// Meizu
implementation 'com.tencent.timpush:meizu:7.7.5283'
// Google Firebase Cloud Messaging (Google FCM)
implementation 'com.tencent.timpush:fcm:7.7.5283'
}
Define a function to handle push notification click events. This function should have the following signature:
(ext: string, userID?: string, groupID?: string): void;
The ext
parameter contains the full ext information for the message, as specified by the sender.
If not specified, a default value will be used. You can parse this parameter to navigate to the
corresponding page.
The userID
and groupID
parameters are automatically parsed from the ext JSON string by the
plugin, containing the userID of the chat partner and the groupID of the group chat, respectively.
If the default ext field is used (specified by the SDK or UIKit), you can use these default values.
If parsing fails, they will be null.
Register the push plugin by calling the TimPushPlugin.getInstance().registerPush
method after
successfully logging in to the IM module and before using any other plugins (such as CallKit). Pass
in the click callback function defined in the previous step.
Optionally, you can also pass in the apnsCertificateID
for iOS and androidPushOEMConfig
for
Android if needed.
FAQs
Tencent IM Push
The npm package react-native-tim-push receives a total of 9 weekly downloads. As such, react-native-tim-push popularity was classified as not popular.
We found that react-native-tim-push demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.