flutter_local_notifications icon indicating copy to clipboard operation
flutter_local_notifications copied to clipboard

Issue with Android 14

Open p3pp8 opened this issue 1 year ago • 3 comments

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!

p3pp8 avatar May 03 '24 13:05 p3pp8

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
);

adnanjpg avatar May 04 '24 12:05 adnanjpg

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 avatar May 06 '24 09:05 p3pp8

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

p3pp8 avatar May 07 '24 08:05 p3pp8

Sounds like OP has gotten issue resolved so closing this

MaikuB avatar Jun 12 '24 09:06 MaikuB

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

Istiak-Ahmed78 avatar Sep 06 '24 10:09 Istiak-Ahmed78

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

chiragdhunna avatar Oct 03 '24 10:10 chiragdhunna

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.

adnanjpg avatar Oct 04 '24 08:10 adnanjpg