tencent cloud

Feedback

React-Native

Last updated: 2024-06-24 15:45:32
The current messaging push plugin, when utilized within React Native, exclusively supports dispatching notifications to Android devices (including channels from various manufacturers) and iOS devices.
iOS
Android
Before integrating the TIMPush component, you need to apply for an APNs Push Certificate from Apple and then upload the Push Certificate to the IM console. After that, you can proceed with the quick access steps.
There are currently two mainstream types of certificates for Apple Manufacturer Configuration: p12 certificates and p8 certificates. Each type of certificate has its advantages and drawbacks, and you can choose one according to your needs.
Certificate Type:
p12 Certificate: A p12 certificate is a binary file containing both a public key and a private key, used for certificate-based authentication. It bundles the public key certificate and the private key into one file, with extensions .p12 or .pfx.
p8 Certificate: A p8 certificate is an Auth Key, used for token-based authentication. It is a text file containing a private key, with an extension of .p8.
Validity and Management:
p12 Certificate: A p12 certificate typically has a one-year validity period, after which it needs to be regenerated and deployed. Each application requires a separate P12 certificate to handle push notifications.
p8 Certificate: A p8 certificate does not have an expiration date, so you don't have to worry about the certificate expiring. Moreover, using a P8 certificate can simplify certificate management, as you can use a single p8 certificate to provide push notification services for multiple applications.
Security:
p12 Certificate: A p12 certificate uses certificate-based authentication and requires the private key to be stored on the server. This could increase security risks, as the private key could be accessed by unauthorized users.
p8 Certificate: A p8 certificate uses token-based authentication, which means your server periodically generates a JSON Web Token (JWT) to establish a connection with APNs. This method is more secure, as it doesn't require storing a private key on the server.
Dynamic Island:
p12 Certificate: Not supported.
p8 Certificate: Supports Dynamic Island push notifications.

1. Using a p12 certificate (traditional push certificate)

Step 1: Apply for an APNs certificate

Enable remote push for the app

1. log in to Apple Developer Center website, click Certificates, Identifiers & Profiles or the sidebar's Certificates, IDs & Profiles, enter the Certificates, IDS & Profiles page.

2. click the + next to Identifiers.



3. You can follow the steps below to create a new AppID or add a Push Notification Service to your existing AppID.
Note:
Your App's Bundle ID cannot use the wildcard *, otherwise, the remote push service cannot be used.
4. Check the App IDs box, click Continue to proceed to the next step.

5. Select App, click Continue to proceed to the next step.

6. Configure the Bundle ID and other information, click Continue to proceed to the next step.

7. Check the Push Notifications box to enable the remote push service.


Certificate Generation

1. Select your AppID and choose Configure.

2. In the Apple Push Notification service SSL Certificates window, there are two SSL Certificates for the development environment (Development) and the production environment (Production), as shown below:

3. 
We
first select the Create Certificate for the Development environment, the system will prompt us that we need a Certificate Signing Request (CSR).

4. On a Mac, open Keychain Access tool, in the menu select Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority (Keychain Access - Certificate Assistant - Request a Certificate From a Certificate Authority).

5. Enter your email address, Common Name (your name or company name), select Save to disk, click continue, the system will generate a *.certSigningRequest file.

6. Go back to the page on the Apple Developer website mentioned in Step 3, click Choose File to upload the generated *.certSigningRequest file.

7. Click Continue to generate the push certificate.

8. click Download to download the Development SSL Certificate to your local environment.

9. Repeat steps 1 - 8 above to download the Production SSL Certificate for the production environment to your local machine.
Note:
The certificate for the production environment is actually a combined certificate of Development (Sandbox) + Production, and it can be used as a certificate for both the development and production environments.


10. Double-click the downloaded SSL Certificate for the development and production environments. The system will import it into the keychain.
11. Open the Keychain App, go to log in to > My Certificates, right-click to export the newly created Apple Development IOS Push Services and Apple Push Services for the development and production environments as p12 files respectively.

Note
Set a password when saving the .p12 file.

Step 2: Upload the certificate to the console

1. Log in to the Chat Console.
2. Click Plugin Service-Push-Access Settings to enter the access settings page



3. Click Add Certificate at the bottom of iOS in Vendor Configuration.
4. Select the certificate type, upload the iOS Certificate (.p12), set the certificate password, and click Confirm.



Note:
We recommend naming the uploaded certificate in English (special characters such as brackets are not allowed).
You need to set a password for the uploaded certificate. Without a password, push notifications cannot be received.
For an app published on App Store, the environment of the certificate must be the production environment. Otherwise, push notifications cannot be received.
The uploaded .p12 certificate must be your own authentic and valid certificate.
5. After the pending certificate information is generated, record the certificate's ID.


Second, using a p8 certificate (supports Dynamic Island push notifications)

p8 Certificate: A p8 certificate does not have an expiration date, so you don't have to worry about the certificate expiring. Moreover, using a p8 certificate can simplify certificate management, as you can use a single p8 certificate to provide push notification services for multiple applications. In addition, p8 certificates support Dynamic Island push notifications.

Step 1: Apply for an APNs certificate

To create a p8 certificate file, first log in to Apple Developer Center.

1. Enter Certificates, Identifiers & Profiles: In the top right corner of the page, click Account, then select Certificates, Identifiers & Profiles from the dropdown menu.
2. To create a new App ID: in the left-hand menu, click Identifiers, then click the + on the right to create a new App ID. Fill in the relevant information and click Continue.
3. To create a new key: in the left-hand menu, click Keys, then click the + on the right to create a new key. Enter the name of the key, then check Apple Push Notifications service (APNs) and click Continue.

Confirm and generate the key: On the confirmation page, verify your key information, then click Register. Next, you'll see a page prompting you to download the key. Click Download and save the generated .p8 file to your computer.
Note:
The p8 certificate can only be downloaded once; please save it properly.
Please safeguard the downloaded p8 file, as you will not be able to download it again. You can use this p8 certificate to configure your iOS applications to receive push notifications.

Step 2: Upload the p8 certificate to the IM console

1. Log in to the Chat Console.
2. Click Plugin Service-Push-Access Settings to enter the access settings page
3. Click Add Certificate at the bottom of iOS in Vendor Configuration.
4. Select the .p8 certificate

Operation step

Step 1. Register your app with vendor push platforms

To utilize the offline push feature, you need to register your app on each vendor's push platform to obtain parameters such as AppID and AppKey. Currently, the mobile manufacturers supported in China include: Mi, Huawei, Honor, OPPO, Vivo, Meizu, and internationally Google FCM is supported.

Step 2. Create resources in the IM console

Log in to Tencent Cloud Chat Console, then in the Push Management > Access Settings feature section, add each vendor's push certificate, and configure the AppID, AppKey, AppSecret, and other parameters obtained in Step 1 to the added push certificate.
Explanation of the Subsequent Actions option:
Open Application: Clicking the notification bar launches the app, by default starting the app's Launcher interface;
Open Web Page: Clicking the notification bar will redirect to the configured web link;
Open the specified interface within the app: clicking the notification bar will redirect the interface based on the configured self Definition, see Custom Redirect on Click.
Mi
Huawei
OPPO
vivo
Meizu
HONOR
Google FCM
Vendor Push Platform
Configuring in the IM console






Vendor Push Platform
Configuring in the IM console






Note:
Client ID corresponds to AppID, Client Secret corresponds to AppSecret.


Vendor Push Platform
Configuring in the IM console







Vendor Push Platform
Configuring in the IM console






For receipt configuration, please refer to: Message reach statistics configuration - vivo.

Vendor Push Platform
Configuring in the IM console






For receipt configuration, please refer to: Message reach statistics configuration - Meizu.

Vendor Push Platform
Configuring in the IM console








Vendor Push Platform
Configuring in the IM console







Note:
Regarding Click for Subsequent Actions supports the Report Statistics feature:
1. If you choose to open an app or a web page, purchasing the plugin will by default support reporting statistics.
2. If you choose to open a specified interface within the application:
For new certificate status, please directly use the auto-fill default value to support click statistics reporting.
If there was a certificate configured previously, continue using the old certificate and modify it to the default value to support reporting statistics, or regenerate a new certificate.

About FCM Data Messaging

FCM provides two push methods: Notification Message and Data Messaging.
Notification Message, with a simple style not differentiated by device, can support offline push once successfully integrated;
Data Messaging, offering rich customization for specific devices, supports reach and click reporting, and requires testing on the device before going live after integration.
The console defaults to Notification Message, and switching between modes can be done in the IM Console:

Note:
FCM Data Messaging capability is only supported on Pixel phones with TIMPush 7.8 and above, other manufacturers' devices need to be self-tested for support;



Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support