MaikuB / flutter_local_notifications

A Flutter plugin for displaying local notifications on Android, iOS, macOS and Linux
2.47k stars 1.4k forks source link

Issue with Android 14 #2316

Closed p3pp8 closed 5 months ago

p3pp8 commented 6 months ago

Hello there, i'm facing an issue with a device running on Android 14 OS, the device is Galaxy A23 5g. I followed the configuration steps and everything seem to be ok, i set permission to use SCHEDULE_EXACT_ALARM and request permission for OS 14 as described in the guide but when i run my application it opens the alarms permission screen but the authorization switch is locked and i'm not able to enable it, so the plugin initialization fails with:

Unhandled Exception: PlatformException(exact_alarms_not_permitted, Exact alarms are not permitted, null, nul

Of course adding USE_EXACT_ALARMS permission everything works just fine but as you know this permission is subject to vendor revision.

Any help really appreciated!

adnanjpg commented 6 months ago

please first of all make sure you're on the latest version.

if you're not building an alarm app, setting zonedSchedule method's androidScheduleMode parameter to AndroidScheduleMode.inexact or AndroidScheduleMode.inexactAllowWhileIdle will fix this for you.

final myinst = FlutterLocalNotificationsPlugin();
myinst.zonedSchedule(
            ...,
            ...,
            ...,
            ....,
            ...,
            androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle, // or AndroidScheduleMode.inexact
);
p3pp8 commented 6 months ago

Hello, thank You for the answer! Yes i'm using latest version of the plugin but unfortunately setting to mode inexact doesn't solve the issue, the switch button in system alarms and reminders screen is still locked.

p3pp8 commented 6 months ago

@adnanjpg Yes, it works, even when permission switch is locked. It solved the issue. Thank You!

MaikuB commented 5 months ago

Sounds like OP has gotten issue resolved so closing this

Istiak-Ahmed78 commented 2 months ago

please first of all make sure you're on the latest version.

if you're not building an alarm app, setting zonedSchedule method's androidScheduleMode parameter to AndroidScheduleMode.inexact or AndroidScheduleMode.inexactAllowWhileIdle will fix this for you.

final myinst = FlutterLocalNotificationsPlugin();
myinst.zonedSchedule(
            ...,
            ...,
            ...,
            ....,
            ...,
            androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle, // or AndroidScheduleMode.inexact
);

Thanks. It works

chiragdhunna commented 1 month ago

please first of all make sure you're on the latest version.

if you're not building an alarm app, setting zonedSchedule method's androidScheduleMode parameter to AndroidScheduleMode.inexact or AndroidScheduleMode.inexactAllowWhileIdle will fix this for you.

final myinst = FlutterLocalNotificationsPlugin();
myinst.zonedSchedule(
            ...,
            ...,
            ...,
            ....,
            ...,
            androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle, // or AndroidScheduleMode.inexact
);

If it works, why is it not in the main branch?

@adnanjpg

adnanjpg commented 1 month ago

please first of all make sure you're on the latest version. if you're not building an alarm app, setting zonedSchedule method's androidScheduleMode parameter to AndroidScheduleMode.inexact or AndroidScheduleMode.inexactAllowWhileIdle will fix this for you.

final myinst = FlutterLocalNotificationsPlugin();
myinst.zonedSchedule(
            ...,
            ...,
            ...,
            ....,
            ...,
            androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle, // or AndroidScheduleMode.inexact
);

If it works, why is it not in the main branch?

@adnanjpg

Hi, I'm not really sure what you meant by this. Please elaborate the issue you're facing with this.