Silent push
Overview
Silent push is a hidden notification that is delivered to the app. It does not cause any interaction with the user like a typical push. Silent notifications quietly deliver a certain set of data to the app so you may use it to notify that new content is available or inform about changes in the content. This kind of campaign does not affect your UI.
Within the silent push campaign, the SDK provides features such as remote sign out or acquiring location by using a silent push command. Read more in the SDK Commands section.
Configuration
Silent push campaign is served by push notifications. See:
- Configuring push notifications - Android
- Configuring push notifications - iOS
- Configuring push notifications - React Native
- Configuring push notifications - Flutter
Additionally, check possible available configuration options in the Settings.
Checking custom notification payloads
The silent push campaign is designed to send notifications with your own payload and in this case should not be passed to the SDK. However, the campaign allows sending any data in payload including SDK commands. Then, the notification must be handled correctly. You may use the samples below.
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Map<String, String> data = remoteMessage.getData();
if (Injector.isSynerisePush(data)) {
if (Injector.isSilentCommand(data)) {
try {
SilentCommand silentCommand = Injector.getSilentCommand(data);
<<your logic here>>
} catch (ValidationException e) {
e.printStackTrace();
}
}
} else {
<<notification is not from Synerise>>
}
}
Payload
{
"data": {
<<campaign content>>
}
}
SDK Commands
SIGN_OUT
{
"data": {
"issuer": "Synerise",
"message-type": "dynamic-content",
"content-type": "silent-sdk-command",
"content": {
"class_name": "com.synerise.sdk.injector.Injector",
"method_name": "SIGN_OUT",
"method_parameters": []
}
}
}
GET_LOCATION
{
"data": {
"issuer": "Synerise",
"message-type": "dynamic-content",
"content-type": "silent-sdk-command",
"content": {
"class_name": "com.synerise.sdk.injector.Injector",
"method_name": "GET_LOCATION",
"method_parameters": []
}
}
}