Firebase Messaging Service
Firebase Messaging Service for Partner banks
- Nuclei SDK only supports Firebase Message Service for push notifications.
- To allow push notifications, the partner bank has to integrate the FirebaseMessagingService into their app.
- After creating account, partner will get the
google-services.json
which they have to share mandatory to Nuclei for availing the push-notification service. This can be shared separately over the mail thread. - The template for push-notification is sent from Nuclei's backend;
- The client handling of the notification is dependent on the partner;
- if the partner opts to handle the notifications at their end then the related template will be send form nuclei server.
- else if, the partner asks Nuclei to handle notifications, the same will be handled through nuclei SDK.
- Note: partner need to share the device specific FCM_KEY to nuclei through the SDK in case they want the notification to be handled by us.
- The partner need to override the
onNewToken
&onMessageReceived
methods after integrating the firebase messaging service.
@Override
public void onNewToken(String token) {
try {
super.onNewToken(token);
if (BankApplication.getNucleiSDK() != null) {
/// if the bank is opting nuclei to handle push-notification
/// then they have to implement the following code:
BankApplication.getNucleiSDK().setPushNotificationKey(token);
}else{
/// partner to store the FCM token in the device storage &
/// send the token to nuclei when initialiasing the nuclei-SDK;
/// partner can use the setPushNotificationKey property to set the token.
}
} catch (Exception e) {
BankAppLogger.logException(TAG, e);
}
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Map data = remoteMessage.getData();
if (data != null && !data.isEmpty()) {
if (!SampleApplication.getNucleiSDK().handleNotification(data)) {
/// partner to handle push-notification
partnerHandlingNotification(data);
}
} else {
log("invalid notification data");
}
}
- NOTE:
google-services.json
is important & mandatory if the partner is opting for the push-notification service of nuclei; But FCM_KEY is optional and dependents on the partner to share in case they opting Nuclei to handle push notifications else partner can internally handle it. - How to set the FCM_TOKEN when initialising the nuclei_SDK?
- Partner needs to write the logic of getting the value of the FCM_TOKEN from the device store which they have stored in onNewToken method.
- Then call the
setpushNotificationkey
property of the nuclei-sdk to pass the FCM_TOKEN to nuclei.
nucleiSDK.setPushNotificationKey(**Logic to get the FCM_KEY from the device store.**);