logo
In-app Chat
SDK Error Codes
Powered Byspreading
On this page

Implement silent push notifications

Introduction

Silent push notifications are a special type of remote notification, mainly used for data synchronization between the App running in the background and the server. For example: when the App is not active and the data within the App is outdated, the server will send a silent push notification, and the App will update the data without any user awareness.

Note

This documentation is applicable to Android smart phones that support Google services.

Prerequisites

Before implementing silent push notifications, please make sure of the following:

Implementation steps

  1. Contact ZEGOCLOUD Technical Support to configure the resourceID for carrying silent push strategies.

  2. In scenarios where offline push notifications need to be sent (such as call invitation, offline push notification, etc.), fill in the ZIMPushConfig > resourceID with the pre-configured value obtained from ZEGOCLOUD Technical Support. Additionally, fill in the payload field according to the specific business scenario.

Untitled
pushConfig.resourcesID = @"resourcesID configured by ZEGOCLOUD Technical Support";
1
Copied!
  1. Create a class that inherits from ZPNsMessageReceiver and declare it as the broadcast receiver for ZPNs. Refer to Implementing Offline Push - Set up the offline push notification feature using the ZPNs SDK for the declaration details.

    You can implement the specific logic for receiving silent push notifications in the onThroughMessageReceived method within the new class.

Untitled
public class MyZPNsReceiver extends ZPNsMessageReceiver {
    // push service provider callback on pass-through message 
    @Override
    protected void onThroughMessageReceived(Context context, ZPNsMessage message) {
        Log.e("MyZPNsReceiver", "onThroughMessageReceived message:" + message.toString());
        // You can get the specific content of the silent push notification through message.getExtras().
    }
}
1
Copied!
  1. Once the above steps are completed, you can send silent push notifications to others and receive silent push notifications from others.

Previous

Cross application offline push

Next

Notify with photo attachment