Как извлечь заголовок сообщения и форму тела push-уведомлений OneSignal FlutterAndroid

Форум для тех, кто программирует под Android
Anonymous
Как извлечь заголовок сообщения и форму тела push-уведомлений OneSignal Flutter

Сообщение Anonymous »

Ребята, я пытаюсь получить заголовок и текст уведомления из push-уведомлений OneSignal. Я пытался получить данные из JSON, например HTTP, но это не сработало

OneSignal.shared
.setNotificationReceivedHandler((OSNotification notification) {
// will be called whenever a notification is received

print('Recived Notification is : $notification');

notification.convertToJsonString({'title': title, 'alert': body});

print('Title is : $title');
print('Description is : $body');
});

onesignal( 9471): Created json raw payload: {vis=1, google.original_priority=normal, google.sent_time=1566080374593, pri=5, grp_msg=, google.delivered_priority=normal, custom={"i":"cb91f929-3008-4364-a687-1675448c2d0a"}, oth_chnl=, title=Welcom test Notification, google.message_id=0:1566080374598190%ab53bc02f9fd7ecd, alert=this is description of welcome text content notification, google.ttl=259200, from=613584415888, notificationId=173367476}
I/flutter ( 9471): Recived Notification is : Instance of 'OSNotification'
I/flutter ( 9471): Title is : null
I/flutter ( 9471): Description is : null


Подробнее здесь: https://stackoverflow.com/questions/575 ... ns-flutter

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