Push Notifications
Firebase configuration#
In order to enable MeetingLawyers Chat notifications, there are two possibilities:
If you have your own Firebase app declared, you must provide us the
google-services.jsonfrom your Firebase workspace.If you don't have Firebase and don't want to create it, we can provide one. For Android we need your
App Package, and for iOS we need the.p8 Certificate file,Team ID, and thecertificate key. Once the Firebase app is created, we'll provide you google-services.json and GoogleService-info.plist files to add to your apps.
Sample: Our example with push notification
Push notifications#
MeetingLawyersSDK framework uses push notifications to communicate pending messages to users. 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 requested 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 implement system remote notification calls to notify MeetingLawyersSDK with the new device token. To do so, we require implementing the following methods in your AppDelegate.swift:
Now create a PushNotificationSample class to unify all code and make our code cleaner:
Receive push token:
Now, the app can receive chat notifications. After that you must pass notifications to library methods to process the Push Notification info:
Handle didReceive error#
If there is any error using func userNotificationCenter(_ userNotificationCenter: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) should be handled and the result redirected.

The SDK can handle the notification only if the top view controller is an instance of ProfessionalListViewController, MessagesViewController, or ProfileViewController. If the top view controller is not from the SDK (for example, it is one from your application), the method will return a MeetingLawyersError error.
The error can have one of these values:
actionFailed(reason: ActionFailureReason)pushesFailed(reason: PushesFailureReason)
And if the value is actionFailed case, the reason values of this error are one of the following, which can be used in the execute function:
executionError(pendingAction: MeetingLawyersAction)
The variable of type MeetingLawyersAction should be saved until an instance of the SDK is rendered as the Top ViewController. At this moment, you can call the method func execute(action: MeetingLawyersAction, origin: UIViewController?, completionHandler: @escaping (MeetingLawyersError?) -> Void) to continue with the navigation.
note
If you use Firebase notifications with Certificates instead of Key Authorization (.p8), you must add the next piece of code:
caution
It is necessary that the host application has the necessary permissions and entitlements to receive push notifications.
It is essential to provide an Authorization key to the administrator of your MeetingLawyer account so that notifications are received correctly.
It is highly recommended to implement background fetch result and modify your app capabilities to include 'fetch' and 'remote-notification' entitlements.
Next steps#
- Unread Messages Count: Messages Count
- Show professionals list: Professionals List