fix: Request notification permissions on iOS before getToken
This commit is contained in:
parent
039771ee5e
commit
69711506ea
1 changed files with 4 additions and 3 deletions
|
|
@ -72,6 +72,9 @@ class BackgroundPush {
|
|||
|
||||
void _init() async {
|
||||
try {
|
||||
if (PlatformInfos.isIOS) {
|
||||
await firebase?.requestPermission();
|
||||
}
|
||||
await _flutterLocalNotificationsPlugin.initialize(
|
||||
const InitializationSettings(
|
||||
android: AndroidInitializationSettings('notifications_icon'),
|
||||
|
|
@ -147,9 +150,7 @@ class BackgroundPush {
|
|||
Set<String?>? oldTokens,
|
||||
bool useDeviceSpecificAppId = false,
|
||||
}) async {
|
||||
if (PlatformInfos.isIOS) {
|
||||
await firebase?.requestPermission();
|
||||
} else if (PlatformInfos.isAndroid) {
|
||||
if (PlatformInfos.isAndroid) {
|
||||
_flutterLocalNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue