Theia adlı üyeden alıntı: mesajı görüntüle
bu şekilde denermisin bi

import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:your_app/in_app_services.dart';
import 'package:your_app/chat_provider.dart';
import 'package:your_app/my_app.dart';

Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();
  print('Arka planda gelen mesaj: ${message.notification?.title}');
}

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Future.wait([
    Firebase.initializeApp(
      options: const FirebaseOptions(
        apiKey: 'X',
        appId: 'X',
        messagingSenderId: 'X',
        projectId: 'X',
      ),
    ),
    EasyLocalization.ensureInitialized(),
  ]);


  FirebaseAnalytics.instance.setAnalyticsCollectionEnabled(false);


  FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
  await FirebaseMessaging.instance.setAutoInitEnabled(true);


  await AwesomeNotifications().initialize(
    'resource://drawable/ic_notification', // Bildirim simgesi
    [
      NotificationChannel(
        channelKey: 'basic_channel',
        channelGroupKey: 'basic_channel_group',
        channelName: 'Basic notifications',
        channelDescription: 'Notification channel for basic tests',
        defaultColor: Colors.black,
        ledColor: Colors.white,
        importance: NotificationImportance.High,
        channelShowBadge: true,
        icon: 'resource://drawable/ic_notification', // Simge kaynağı
      ),
    ],
    debug: true,
  );

  await registerNotification();

  runApp(
    MultiProvider(
      providers: [
        ChangeNotifierProvider(create: (context) => InAppServices()),
        ChangeNotifierProvider(
            create: (context) => ChatProvider(context.read<InAppServices>())),
      ],
      child: EasyLocalization(
        assetLoader: const CodegenLoader(),
        supportedLocales: const [Locale('tr', 'TR')],
        fallbackLocale: const Locale('tr', 'TR'),
        startLocale: const Locale('tr', 'TR'),
        path: 'assets/translations',
        child: const MyApp(),
      ),
    ),
  );
}

Future<void> registerNotification() async {
  FirebaseMessaging messaging = FirebaseMessaging.instance;

  // Kullanıcıdan bildirim izinlerini isteme
  NotificationSettings settings = await messaging.requestPermission(
    alert: true,
    badge: true,
    provisional: false,
    criticalAlert: true,
    sound: true,
  );

  print('Bildirim izin durumu: ${settings.authorizationStatus}');

  // Ön plan mesajları için yapılandırma
  FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
    try {
      if (message.notification != null) {
        await AwesomeNotifications().createNotification(
          content: NotificationContent(
            id: DateTime.now().millisecondsSinceEpoch ~/ 1000,
            channelKey: 'basic_channel',
            title: message.notification?.title ?? 'No Title',
            body: message.notification?.body ?? 'No Body',
          ),
        );
      }
    } catch (e) {
      debugPrint('Bildirim hatası: $e');
    }
  });

  await messaging.setForegroundNotificationPresentationOptions(
    alert: true,
    badge: true,
    sound: true,
  );
}
İlk bildirim 2 dakika sonra geliyor ve ardından yanıt vermiyor diyor. Yine aynı bekle dediğimde diğer chat mesajlrı anlık düşmeye başlıyor sorunsuz bir şekilde. Hata devam ediyor.

Çıktı:
D/FLTFireMsgReceiver(20150): broadcast received for message
W/MIUIScout ANR(20150): AnrScout only want msg within 20s, so stop here
D/MIUIScout ANR(20150): get period history msg: (Current message: duration=25ms seq=179 binder=70420ms h=android.os.Handler c=io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0)
D/MIUIScout ANR(20150): get period history msg:execute time>50ms (msgIndex=1seq=176 plan=23:24:27.713 late=1ms wall=75ms running=17ms runnable=1ms binder=2ms h=android.app.ActivityThread$H w=113)      
D/MIUIScout ANR(20150): get period history msg:In recent 20s, total historyMsgCount=3
D/CompatibilityChangeReporter(20150): Compat change id reported: 160794467; UID 10608; state: ENABLED
D/Android: [Awesome Notifications](20150): Notification created and displayed in 90ms (NotificationSender:202)
I/.ftbk.flirtboo(20150): Thread[5,tid=20185,WaitingInMainSignalCatcherLoop,Thread*=0xb400006ffa5a5c00,peer=0x13e40270,"Signal Catcher"]: reacting to signal 3
I/.ftbk.flirtboo(20150): 
I/.ftbk.flirtboo(20150): Wrote stack traces to tombstoned
F/crash_dump64(21237): crash_dump.cpp:509] failed to attach to thread 720: Permission denied