I try to find a way to send notifications to android devices that are limiting app activities in background, mostly Chinese brands like Huawei and Oppo.
The weird think is i'm able to receive the notification only if sent from the firebase console.
Here is how i program the notifications in the app:
const notification = new firebase.notifications.Notification()
.setNotificationId(notificationId)
.setTitle('some title')
.setBody('body')
.setData({
screen: 'AroundMe',
})
.setSound('default')
.android.setChannelId('fcm_default_channel')
.android.setSmallIcon('ic_launcher')
.android.setPriority(firebase.notifications.Android.Priority.Max)
.android.setVisibility(
firebase.notifications.Android.Visibility.Public,
)
.android.setAutoCancel(true)
firebase.notifications().scheduleNotification(notification, {
fireDate: d.getTime(),
});
I'm aware that the app can be authorized in the phone settings so it can receive notification in background, but why the ones sent from the firebase console can be shown without that??
THANKS!