Upgrade to Android Oreo and issue with Firebase Cloud Messaging

create a channel id

<string name="default_notification_channel_id" translatable="false">fcm_default_channel</string>

add a meta-data in manifest file

<application>
...
<meta-data        android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id"/>
</application>

channel assignment

...
// Since android Oreo notification channel is needed.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    String channelId = context.getString(R.string.default_notification_channel_id);
    NotificationChannel channel = new NotificationChannel(channelId,   title, NotificationManager.IMPORTANCE_DEFAULT);
    channel.setDescription(body);
    mNotificationManager.createNotificationChannel(channel);
    builder.setChannelId(channelId);
}
mNotificationManager.notify(1, notification);
...

References
https://medium.com/globallogic-latinoamerica-mobile/firebase-cloud-messaging-warning-updating-to-android-oreo-1343fe894bd5
https://firebase.google.com/docs/cloud-messaging/android/receive

Firebase Admin Multi App Initialization

require('firebase');
var admin = require('firebase-admin');
var firstServiceAccount = require('path/to/service-account-1');
var secondServiceAccount = require('path/to/service-account-2');

var _first = admin.initializeApp(
  {
    credential: admin.credential.cert(firstServiceAccount),
    databaseURL: 'https://<1st-db-name>.firebaseio.com'
  }, 
  'first' // this name will be used to retrieve firebase instance. E.g. first.database();
);

var _second = admin.initializeApp(
  {
    credential: admin.credential.cert(secondServiceAccount),
    databaseURL: 'https://<2nd-db-name>.firebaseio.com'
  }, 
  'second' // this name will be used to retrieve firebase instance. E.g. second.database();
);

exports.first = _first;
exports.second = _second;

Usage

var first = require('../path/to/the/file/above');
var second = require('../path/to/the/file/above');
 
first.database();
second.database();

References
https://gist.github.com/jofftiquez/1317de9ce97ab72b8295013a3f2ccff0
https://gist.github.com/jofftiquez/6d4bb432c7b25fe9a89e8f5231ea8ce2