fix: Request notification permission on android
This commit is contained in:
parent
565270757d
commit
6cc2c6a578
2 changed files with 7 additions and 0 deletions
|
|
@ -139,6 +139,11 @@ class BackgroundPush {
|
||||||
}) async {
|
}) async {
|
||||||
if (PlatformInfos.isIOS) {
|
if (PlatformInfos.isIOS) {
|
||||||
await firebase?.requestPermission();
|
await firebase?.requestPermission();
|
||||||
|
} else if (PlatformInfos.isAndroid) {
|
||||||
|
_flutterLocalNotificationsPlugin
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin>()
|
||||||
|
?.requestNotificationsPermission();
|
||||||
}
|
}
|
||||||
final clientName = PlatformInfos.clientName;
|
final clientName = PlatformInfos.clientName;
|
||||||
oldTokens ??= <String>{};
|
oldTokens ??= <String>{};
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ Future<void> pushHelper(
|
||||||
ticker: l10n.unreadChats(notification.counts?.unread ?? 1),
|
ticker: l10n.unreadChats(notification.counts?.unread ?? 1),
|
||||||
importance: Importance.max,
|
importance: Importance.max,
|
||||||
priority: Priority.max,
|
priority: Priority.max,
|
||||||
|
shortcutId: notification.roomId,
|
||||||
fullScreenIntent: true, // To show notification popup
|
fullScreenIntent: true, // To show notification popup
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -233,6 +234,7 @@ Future<void> _tryPushHelper(
|
||||||
channelDescription: groupName,
|
channelDescription: groupName,
|
||||||
number: notification.counts?.unread,
|
number: notification.counts?.unread,
|
||||||
category: AndroidNotificationCategory.message,
|
category: AndroidNotificationCategory.message,
|
||||||
|
shortcutId: event.room.id,
|
||||||
styleInformation: messagingStyleInformation ??
|
styleInformation: messagingStyleInformation ??
|
||||||
MessagingStyleInformation(
|
MessagingStyleInformation(
|
||||||
person,
|
person,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue