Я разрабатываю приложение Flutter с Push -уведомлением от Firebase и разрабатываю в своем iPhone. Функция уведомления работает, но я хочу добавить функцию перенаправления (перенаправление на специальную страницу (имя маршрута - «/map").образное, Функция ondidReceivenotificationResponse будет вызоваться, когда я нажимаю на сообщение об уведомлении, но она будет повторять код в код ondidReceiensifitionresses , но не является функцией Redirect. /> Вывод журнала < /p>
Flutter: Уведомление о полезной нагрузке:
Flutter: ondidReceivenotificationResponse
flutter: уведомление:
flutter: ondidreceivensresponse
flutter: ondidReceivensresponse
flutter: ondidreceivencresponse
flutter: ondidreceivencressponseresseson />
Flutter: OnDidReceivenotificationResponse < /p>
< /blockquote>
class NotificationService {
final notificationPlugin = FlutterLocalNotificationsPlugin();
static final onNotifications = BehaviorSubject();
bool _isInitialized = false;
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
Future initNotification() async {
print("NotificationService initNotification 1");
if (_isInitialized) return;
const initSettingsAndroid =
AndroidInitializationSettings('@mipmap/ic_launcher');
const initSettingsIOS = DarwinInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: true,
requestSoundPermission: true,
);
void onDidReceiveNotificationResponse(
NotificationResponse notificationResponse) async {
final String? payload = notificationResponse.payload;
if (notificationResponse.payload != null) {
debugPrint('notification payload: $payload');
debugPrint('onDidReceiveNotificationResponse');
AppGlobal.navigatorKey.currentState?.pushNamed('/map');
}
}
const initSetting = InitializationSettings(
android: initSettingsAndroid, iOS: initSettingsIOS);
await flutterLocalNotificationsPlugin.initialize(initSetting,
onDidReceiveNotificationResponse: (notificationResponse) =>
onDidReceiveNotificationResponse(notificationResponse));
_isInitialized = !_isInitialized;
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... n-not-work
Flutter Push -уведомление о функции не работает ⇐ IOS
Программируем под IOS
-
Anonymous
1751985325
Anonymous
Я разрабатываю приложение Flutter с Push -уведомлением от Firebase и разрабатываю в своем iPhone. Функция уведомления работает, но я хочу добавить функцию перенаправления (перенаправление на специальную страницу (имя маршрута - «/map").образное, Функция ondidReceivenotificationResponse будет вызоваться, когда я нажимаю на сообщение об уведомлении, но она будет повторять код в код ondidReceiensifitionresses , но не является функцией Redirect. /> Вывод журнала < /p>
Flutter: Уведомление о полезной нагрузке:
Flutter: ondidReceivenotificationResponse
flutter: уведомление:
flutter: ondidreceivensresponse
flutter: ondidReceivensresponse
flutter: ondidreceivencresponse
flutter: ondidreceivencressponseresseson />
Flutter: OnDidReceivenotificationResponse < /p>
< /blockquote>
class NotificationService {
final notificationPlugin = FlutterLocalNotificationsPlugin();
static final onNotifications = BehaviorSubject();
bool _isInitialized = false;
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
Future initNotification() async {
print("NotificationService initNotification 1");
if (_isInitialized) return;
const initSettingsAndroid =
AndroidInitializationSettings('@mipmap/ic_launcher');
const initSettingsIOS = DarwinInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: true,
requestSoundPermission: true,
);
void onDidReceiveNotificationResponse(
NotificationResponse notificationResponse) async {
final String? payload = notificationResponse.payload;
if (notificationResponse.payload != null) {
debugPrint('notification payload: $payload');
debugPrint('onDidReceiveNotificationResponse');
AppGlobal.navigatorKey.currentState?.pushNamed('/map');
}
}
const initSetting = InitializationSettings(
android: initSettingsAndroid, iOS: initSettingsIOS);
await flutterLocalNotificationsPlugin.initialize(initSetting,
onDidReceiveNotificationResponse: (notificationResponse) =>
onDidReceiveNotificationResponse(notificationResponse));
_isInitialized = !_isInitialized;
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79694302/flutter-push-notification-onclick-function-not-work[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия