Как показать собственный значок приложения во flutter_local_notification во флаттере?Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Как показать собственный значок приложения во flutter_local_notification во флаттере?

Сообщение Anonymous »

Я пытаюсь отправить локальное уведомление в Android с помощью flutter_local_notifications, и оно работает нормально. Но проблема в том, что я не могу отобразить собственный значок приложения на панели уведомлений. Итак, может ли кто-нибудь помочь мне поделиться решением. Заранее спасибо!
Вот и код и изображение-

Код: Выделить всё

 const notificationChannelId = 'fit_jerk';
const notificationId = 1;

final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();

const AndroidNotificationChannel channel = AndroidNotificationChannel(
notificationChannelId, // id
'MY FOREGROUND SERVICE', // title
description:
'This channel is used for sending daily quotation.', // description
importance: Importance.low, // importance must be at low or higher level
);

await flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.createNotificationChannel(channel);

await service.configure(
androidConfiguration: AndroidConfiguration(
onStart: onStart,
autoStart: true,
isForegroundMode: true,
notificationChannelId: notificationChannelId, // this must match with notification channel you created above.
initialNotificationTitle: 'FitJerk',
initialNotificationContent: 'Welcome to FitJerk',
foregroundServiceNotificationId: notificationId,
), iosConfiguration: IosConfiguration(),);}

await flutterLocalNotificationsPlugin.show(
notificationId,
'FitJerk',
todayQuote,
const NotificationDetails(
android: AndroidNotificationDetails(
notificationChannelId,
'MY FOREGROUND SERVICE',
icon: 'mipmap/ic_launcher',
ongoing: false,
),
),
);
Изображение

Изображение



Подробнее здесь: https://stackoverflow.com/questions/751 ... in-flutter
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»