Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    How to run RAG projects for better data analytics results

    October 13, 2025

    MacBook Air deal: Save 10% Apple’s slim M4 notebook

    October 13, 2025

    Part 1 – Energy as the Ultimate Bottleneck

    October 13, 2025
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»ios – Flutter scheduled (time-based) notifications don’t fire on Android — immediate notifications work
    iOS Development

    ios – Flutter scheduled (time-based) notifications don’t fire on Android — immediate notifications work

    big tee tech hubBy big tee tech hubAugust 9, 20250563 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    ios – Flutter scheduled (time-based) notifications don’t fire on Android — immediate notifications work
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    I’m building my first Flutter app for Android and iOS and I’m stuck with scheduled notifications on Android.

    • What works: immediate notifications (show(…)) display fine after the user enables notifications.
    • What doesn’t: time-based (scheduled/weekly) notifications never fire at the selected weekday & time.
    • Permissions: On Android, the app asks for notification permission and I’ve also enabled Alarms & reminders (Schedule exact alarms) in system settings. Both are ON.

    Environment

    • flutter_local_notifications: ^19.4.0
    • timezone: ^0.10.1
    • flutter_timezone: ^4.1.1
    • Device(s): [Android Studio + Medium Device API 36, Samsung Galaxy S23 + Android 15

    What I expect
    When the user picks a weekday and time (e.g., Monday at 09:00), a notification should appear then, and repeat weekly.

    What actually happens
    Nothing fires at the scheduled time. No crashes. Immediate notifications using the same channel work reliably.

    Code:
    Settings_Screen

    import 'package:my_app/config/notifications.dart';
    
     // --- Notifications ---
              const Divider(height: 32),
              SwitchListTile(
                title: const Text('Benachrichtigungen aktivieren'),
                value: _notifEnabled,
                onChanged: _toggleNotifications,
              ),
    
              if (_notifEnabled) ...[
                _buildExactStatusTile(), // neu
    
                const SizedBox(height: 8),
                const Text('Wochentag', style: TextStyle(fontWeight: FontWeight.bold)),
                Wrap(
                  spacing: 8,
                  children: List.generate(7, (i) {
                    final int day = i + 1; // 1=Mo ... 7=So
                    const labels = ['Mo','Di','Mi','Do','Fr','Sa','So'];
                    return ChoiceChip(
                      label: Text(labels[i]),
                      selected: _notifWeekday == day,
                      onSelected: (_) async {
                        setState(() => _notifWeekday = day);
                        await _persistNotificationPrefs();
                        await _applyNotificationSchedule();
                      },
                    );
                  }),
                ),
    
                const SizedBox(height: 16),
                ListTile(
                  leading: const Icon(Icons.access_time),
                  title: Text(
                    _notifTime == null
                        ? 'Uhrzeit auswählen'
                        : 'Uhrzeit: ${_notifTime!.format(context)}',
                  ),
                  onTap: _pickNotificationTime,
                ),
    
                if (_notifWeekday == null || _notifTime == null)
                  const Padding(
                    padding: EdgeInsets.only(top: 8),
                    child: Text(
                      'Hinweis: Bitte Wochentag und Uhrzeit wählen, damit die Erinnerung geplant wird.',
                      style: TextStyle(color: Colors.grey),
                    ),
                  ),
              ],
            ],
          ),
    

    notifications

    import 'package:flutter_local_notifications/flutter_local_notifications.dart';
    import 'package:timezone/timezone.dart' as tz;
    import 'package:flutter_timezone/flutter_timezone.dart';
    import 'package:timezone/data/latest_all.dart' as tzdata;
    
    static tz.TZDateTime _nextWeekdayTime({
        required int weekday, 
        required int hour,
        required int minute,
        Duration grace = const Duration(seconds: 30),
      }) {
        final now = tz.TZDateTime.now(tz.local);
        final todayAt = tz.TZDateTime(tz.local, now.year, now.month, now.day, hour, minute);
        final daysUntil = (weekday - now.weekday) % 7;
        var scheduled = todayAt.add(Duration(days: daysUntil));
        if (scheduled.isBefore(now.add(grace))) {
          scheduled = scheduled.add(const Duration(days: 7));
        }
        return scheduled;
      }
    
      static Future scheduleWeekly({
        required int id,
        required String title,
        required String body,
        required int weekday,
        required int hour,
        required int minute,
        String? payload,
      }) async {
        final when = _nextWeekdayTime(weekday: weekday, hour: hour, minute: minute);
        final mode = await _pickAndroidScheduleMode();
    
    

    main

    import 'package:timezone/data/latest_all.dart' as tz;
    import 'package:timezone/timezone.dart' as tz;
    import 'package:flutter_timezone/flutter_timezone.dart';
    import 'package:my_app/config/notifications.dart' show NotificationsService;
    
    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      tz.initializeTimeZones();
      final name = await FlutterTimezone.getLocalTimezone(); // "Europe/Berlin" etc.
      tz.setLocalLocation(tz.getLocation(name));
      await NotificationsService.init();
    

    AndroidManifest

        
        
        
        
    

    What I’ve tried

    • Confirmed Notifications permission is granted (Android 13+).

    • Enabled Alarms & reminders (Schedule exact alarms) in system settings (Android 12+).

    • Tested with androidAllowWhileIdle: true.

    • Verified the channel is not blocked and importance is max.

    • Disabled battery optimizations for the app.

    • Tested on emulator and physical device.

    • Double-checked that the computed scheduled time is in the future and has the correct weekday.

    • Confirmed Notifications permission is granted (Android 13+).

    • Enabled Alarms & reminders (Schedule exact alarms) in system settings (Android 12+).

    • Tested with androidAllowWhileIdle: true.

    • Verified the channel is not blocked and importance is max.

    • Disabled battery optimizations for the app.

    • Tested on emulator and physical device.

    • Double-checked that the computed scheduled time is in the future and has the correct weekday.



    Source link

    Android Dont FIRE Flutter iOS notifications Scheduled timebased Work
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    ios – Apple mapkit route function dose not works in China

    October 12, 2025

    swift – Does UIDevice.current.identifierForVendor change after iCloud backup and restore on another iOS device?

    October 11, 2025

    uitabbarcontroller – How to add custom UIView to floating UITabBarItem in iOS 26 Liquid Glass UITabBar

    October 10, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    How to run RAG projects for better data analytics results

    October 13, 2025

    MacBook Air deal: Save 10% Apple’s slim M4 notebook

    October 13, 2025

    Part 1 – Energy as the Ultimate Bottleneck

    October 13, 2025

    From Static Products to Dynamic Systems

    October 13, 2025
    Advertisement
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    How to run RAG projects for better data analytics results

    October 13, 2025

    MacBook Air deal: Save 10% Apple’s slim M4 notebook

    October 13, 2025

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2025 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.