mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Android: Trying to get notifications to work in Android 8.x
This commit is contained in:
parent
685845e097
commit
5565538b80
@ -48,6 +48,9 @@
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||
android:resource="@drawable/ic_stat_access_alarm" />
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="@string/default_notification_channel_id"/>
|
||||
<receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver"/>
|
||||
<receiver android:enabled="true" android:exported="true" android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver">
|
||||
<intent-filter>
|
||||
|
@ -1,3 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">Joplin</string>
|
||||
<string name="default_notification_channel_id">net.cozic.joplin.notification</string>
|
||||
</resources>
|
||||
|
@ -2,6 +2,12 @@ import firebase from 'react-native-firebase';
|
||||
|
||||
class AlarmServiceDriver {
|
||||
|
||||
constructor() {
|
||||
this.channel_ = new firebase.notifications.Android.Channel('net.cozic.joplin.notification', 'Joplin Alarm',firebase.notifications.Android.Importance.Max)
|
||||
.setDescription('Displays a notification for alarms associated with to-dos.');
|
||||
firebase.notifications().android.createChannel(this.channel_);
|
||||
}
|
||||
|
||||
hasPersistentNotifications() {
|
||||
return true;
|
||||
}
|
||||
@ -23,10 +29,10 @@ class AlarmServiceDriver {
|
||||
firebaseNotification.setNotificationId(this.firebaseNotificationId_(notification.id));
|
||||
firebaseNotification.setTitle(notification.title)
|
||||
if ('body' in notification) firebaseNotification.body = notification.body;
|
||||
firebaseNotification.android.setChannelId('com.google.firebase.messaging.default_notification_channel_id');
|
||||
firebaseNotification.android.setChannelId('net.cozic.joplin.notification');
|
||||
firebaseNotification.android.setSmallIcon('ic_stat_access_alarm');
|
||||
|
||||
firebase.notifications().scheduleNotification(firebaseNotification, {
|
||||
await firebase.notifications().scheduleNotification(firebaseNotification, {
|
||||
fireDate: notification.date.getTime(),
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user