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 {
|
void _init() async {
|
||||||
try {
|
try {
|
||||||
|
if (PlatformInfos.isIOS) {
|
||||||
|
await firebase?.requestPermission();
|
||||||
|
}
|
||||||
await _flutterLocalNotificationsPlugin.initialize(
|
await _flutterLocalNotificationsPlugin.initialize(
|
||||||
const InitializationSettings(
|
const InitializationSettings(
|
||||||
android: AndroidInitializationSettings('notifications_icon'),
|
android: AndroidInitializationSettings('notifications_icon'),
|
||||||
|
|
@ -147,9 +150,7 @@ class BackgroundPush {
|
||||||
Set<String?>? oldTokens,
|
Set<String?>? oldTokens,
|
||||||
bool useDeviceSpecificAppId = false,
|
bool useDeviceSpecificAppId = false,
|
||||||
}) async {
|
}) async {
|
||||||
if (PlatformInfos.isIOS) {
|
if (PlatformInfos.isAndroid) {
|
||||||
await firebase?.requestPermission();
|
|
||||||
} else if (PlatformInfos.isAndroid) {
|
|
||||||
_flutterLocalNotificationsPlugin
|
_flutterLocalNotificationsPlugin
|
||||||
.resolvePlatformSpecificImplementation<
|
.resolvePlatformSpecificImplementation<
|
||||||
AndroidFlutterLocalNotificationsPlugin>()
|
AndroidFlutterLocalNotificationsPlugin>()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue