gdelataillade / alarm

A Flutter plugin to easily manage alarms on iOS and Android
https://pub.dev/packages/alarm
MIT License
132 stars 86 forks source link

Schedule notification with id 0 error: PlatformException(exact_alarms_not_permitted, Exact alarms are not permitted, null, null) #114

Closed synstin closed 9 months ago

synstin commented 11 months ago

Alarm plugin version latest

Describe the bug

Schedule notification with id 0 error: PlatformException(exact_alarms_not_permitted, Exact alarms are not permitted, null, null)
#0      AlarmNotification.scheduleAlarmNotif (package:alarm/service/notification.dart:147)
<asynchronous suspension>
#1      Alarm.set (package:alarm/alarm.dart:91)
<asynchronous suspension>

I found a log of a user experiencing this bug. I googled the error and stackoverflow told me to add that setting to the manifest file. https://stackoverflow.com/questions/76309215/unhandled-exception-platformexceptionexact-alarms-not-permitted-exact-alarms <uses-permission android:name="android.permission.USE_EXACT_ALARM" />

Do I need to add the USE_EXACT_ALARM setting?

Device info SM-F916N Android 13 (SDK 33)

gdelataillade commented 11 months ago

Hi @synstin

What version of the plugin are you using ?

Yes you need to add USE_EXACT_ALARM android permission in your manifest. Let me know if it fixes your issue.

synstin commented 11 months ago

@gdelataillade I am using version 2.1.1. Is this the way to add it?

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>
gdelataillade commented 11 months ago

@synstin Yes

gdelataillade commented 11 months ago

Hi @synstin

I just released version 3.0.0. Let me know if it fixes your issue.

AwaisQazii commented 10 months ago

@gdelataillade I'm not being able to receive notification on alarm ringing

gdelataillade commented 10 months ago

Hi @AwaisQazii

Did you give permission for notifications ?

If not, check out permission_handler to ask permission.

gdelataillade commented 9 months ago

I'm closing this issue because I believe asking for permission solved it. Feel free to reopen if you still have the problem.