title: Flutter Local notifications - ZonedSchedule notification is not working while the app in background
body: <p>I'm using Flutter local notification plugin for alarm app, the alarm fire when the app is opened or closed but when it's in the background it's not working until it resumed even it's not at the correct time, I know it's a strange thing but it's happening</p>
  <p>Initialization:</p>
  <pre><code> Future&lt;void&gt; initNotifications() async {
      final initSettingsAndroid =
          const AndroidInitializationSettings(&quot;@mipmap/ic_launcher&quot;);
      final initSettings = InitializationSettings(
        android: initSettingsAndroid,
      );
      await FlutterLocalNotificationsPlugin().initialize(initSettings);
      tz.initializeTimeZones();
      final String currentTimeZone =
          await FlutterNativeTimezone.getLocalTimezone();
      tz.setLocalLocation(tz.getLocation(currentTimeZone));
    }
  </code></pre>
  <p>alarm function:</p>
  <pre><code>void alarm(String title, String body, DateTime fireTime) async {
      const androidPlatformChannalSpecifics = AndroidNotificationDetails(
        &quot;alarm notification&quot;,
        &quot;alarm notification&quot;,
        &quot;Channal for Alarm Notification&quot;,
        icon: &quot;@mipmap/ic_launcher&quot;,
        sound: RawResourceAndroidNotificationSound(&quot;alarm&quot;),
        importance: Importance.max,
        priority: Priority.max,
        fullScreenIntent: true,
      );
  
      const notificationDetails =
          NotificationDetails(android: androidPlatformChannalSpecifics);
  
      await FlutterLocalNotificationsPlugin().zonedSchedule(
        0,
        title,
        body,
        TZDateTime.from(fireTime, tz.local),
        notificationDetails,
        payload: &quot;isPressed&quot;,
        androidAllowWhileIdle: true,
        uiLocalNotificationDateInterpretation:
            UILocalNotificationDateInterpretation.absoluteTime,
      );
    }
  </code></pre>
  <p>My permissions and receivers:</p>
  <pre><code>    &lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot;/&gt;
     &lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot; /&gt;
     &lt;uses-permission android:name=&quot;android.permission.WAKE_LOCK&quot; /&gt;
     &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
     &lt;uses-permission android:name=&quot;android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS&quot; /&gt;
     &lt;application
          android:label=&quot;Prodkit&quot;
          android:icon=&quot;@mipmap/ic_launcher&quot;&gt;
          &lt;receiver android:name=&quot;com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver&quot;&gt;
          &lt;intent-filter&gt;
          &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot;&gt;&lt;/action&gt;
         &lt;/intent-filter&gt;
          &lt;/receiver&gt;
          &lt;receiver android:name=&quot;com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver&quot; /&gt;
          &lt;activity
              android:name=&quot;.MainActivity&quot;
              android:launchMode=&quot;singleTop&quot;
              android:theme=&quot;@style/LaunchTheme&quot;
              android:configChanges=&quot;orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode&quot;
              android:hardwareAccelerated=&quot;true&quot;
              android:windowSoftInputMode=&quot;adjustResize&quot;
              android:showWhenLocked=&quot;true&quot;
              android:turnScreenOn=&quot;true&quot;&gt;
  </code></pre>
  <p>I don't know what's the problem exactly but I tried a lot of things and it's not working.</p>