Push Notifications
Firebase Integration
In order to enable MeetingDoctors 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. Once Firebase app are created, we'll provide you google-services.json files to add to your apps.
Push Notifications for Apps without their own FirebaseMessagingService
- Add this code inside
<application>
in AndroidManifest.xml of your project In order to allow library show push notifications. You can overwrite notification icon just defining "com.meetingdoctors.chat.notification_icon".
<!-- meetingdoctors-lib -->
<service android:name="com.meetingdoctors.chat.fcm.MeetingDoctorsFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<!-- optional --><meta-data android:name="com.meetingdoctors.chat.notification_icon" android:resource="@drawable/<YOUR_DRAWABLE>" />
<!-- meetingdoctors-lib -->
Push Notifications for Apps with their own FirebaseMessagingService
- Add the following code in your FirebaseMessagingService class:
class YourFirebaseMessagingService: FirebaseMessagingService() {
override fun onMessageReceived(p0: RemoteMessage) {
super.onMessageReceived(p0)
MeetingDoctorsClient.instance?.onFirebaseMessageReceived(p0, null)
}
}
- If your App update your Firebase Token, you must update to our SDK, you can do this the following way, e.g. in your FirebaseMessagingService class:
class YourtFirebaseMessagingService: FirebaseMessagingService() {
....
override fun onNewToken(p0: String) {
super.onNewToken(p0)
MeetingDoctorsClient.instance?.onNewTokenReceived(p0)
}
}
Disable permission check
When the professional list is shown, it appears an activity with the check of push notification permission. You can disable with the field meetingdoctors_show_permissions_manager in your bools.xml (By default is true)
<bool name ="meetingdoctors_show_permissions_manager">false</bool>
Versions 1.45.X
In versions 1.45.0 or higher, to do the correct flow of the notification push, you must add this line in your MAIN Activity (SplashActivity, MainActivity...)
MeetingDoctorsClient.instance?.onNotificationDataReceived(intent.extras!!)