Skip to main content

Push Notifications

DEPRECATION NOTICE

Our Cordova plugin for integrating our SDK is now deprecated. We highly recommend transitioning to our SDK using Swift Package Manager (SPM) for iOS and Gradle for Android. Please implement a custom wrapper to interface directly with the SDK methods.

For Ionic users, you can transition to using Capacitor, which supports working with native libraries seamlessly. This change will ensure better performance and more direct access to the latest SDK features.

Firebase configuration#

In order to enable MeetingLawyers Chat notifications, there are two posibilities:

1.- If you have your own Firebase app declared, you must provide us Sender ID and Server Key from your Firebase workspace.

2.- If you don't have a Firebase and don't want to create it, we can provide one. For Android we need your App Package, and for iOS we need .p8 Certificate file, Team ID, and the certificate key. Once Firebase app are created, we'll provide you google-services.json and GoogleService-info.plist files to add to your apps.

See: Firebase Documentation

Push notifications#

MeetingLawyersSDK framework uses push notifications to communicate users pending messages, these notifications are served by Firebase SDK.

As soon as the on-screen chat presentation starts, if permissions to send notifications have not yet been needed by the host application, the system security dialog is displayed. When the user grants the necessary permissions to send push notifications, it is mandatory to intervene system remote notification calls to notify MeetingLawyersSDK with the new device token. Use the following method to send the new token to MeetingLawyers system:

meetinglawyers.setFcmToken(token, function() {}, function(err) {})

Now, the app can receive chat notifications. After that you must pass notifications data to library methods to process the Push Notification info:

meetinglawyers.onFcmMessage(data, function(handled) {
if (handled) {
// MeetingLawyers notification
} else {
// Other push notification
}
}, function(err) {});
meetinglawyers.onFcmBackgroundMessage(data, function(handled) {
if (handled) {
// MeetingLawyers notification
} else {
// Other push notification
}
}, function(err) {});

Example cordova-plugin-firebase-messaging#

Example with cordova-plugin-firebase-messaging:

// GET TOKEN
cordova.plugins.firebase.messaging.getToken().then(function(token) {
meetinglawyers.setFcmToken(token, function() {}, function(err) {})
});
// NEW MESSAGE
cordova.plugins.firebase.messaging.onMessage(function(payload) {
meetinglawyers.onFcmMessage(payload.data, function(handled) {}, function(err) {});
});
cordova.plugins.firebase.messaging.onBackgroundMessage(function(payload) {
meetinglawyers.onFcmBackgroundMessage(payload.data, function(handled) {}, function(err) {});
});