У меня проблема с открытием моего приложения на панели уведомлений. При получении push-уведомления от веб-сервера (серверной части) нажатие на уведомление из панели уведомлений не приведет к открытию приложения. Также метод onNotificationOpened не вызывается.
В то же время, когда уведомление было отправлено из консоли Firebase, оно открывает приложение на кран. Также вызывается onNotificationOpened. Нужно ли что-то кодировать, чтобы приложение открывалось из уведомлений Нажмите .. ??
Я попытался добавить прослушиватель onNotificationOpened в App.js, который работает только для уведомлений, отправляемых с консоли Firebase.
Уведомление JSON, полученное с консоли
{ _body: 'Good After noon',
_data: {},
_notificationId: '0:15474xxxxxxxxxx',
_sound: undefined,
_subtitle: undefined,
_title: 'Good After noon',
_android:
{ _notification: [Circular],
_actions: [],
_autoCancel: undefined,
_badgeIconType: undefined,
_bigPicture: undefined,
_bigText: undefined,
_category: undefined,
_channelId: undefined,
_clickAction: undefined,
_color: undefined,
_colorized: undefined,
_contentInfo: undefined,
_defaults: undefined,
_group: 'campaign_collapse_key_1764xxxxxx',
_groupAlertBehaviour: undefined,
_groupSummary: undefined,
_largeIcon: undefined,
_lights: undefined,
_localOnly: undefined,
_number: undefined,
_ongoing: undefined,
_onlyAlertOnce: undefined,
_people: [],
_priority: undefined,
_progress: undefined,
_remoteInputHistory: undefined,
_shortcutId: undefined,
_showWhen: undefined,
_smallIcon: { icon: 'ic_launcher' },
_sortKey: undefined,
_tag: 'campaign_collapse_key_1764xxxxx',
_ticker: undefined,
_timeoutAfter: undefined,
_usesChronometer: undefined,
_vibrate: undefined,
_visibility: undefined,
_when: undefined },
_ios: { _notification: [Circular], _attachments: [] } }
Уведомление JSON отправлено с сервера
{ _body: 'A new booking has been scheduled on 14-01-2019 5:00PM to 6:00PM',
_data: { a_data: '{"type":"Booking","subtype":"create","id":{"id":"5c3cxxxx"}}' },
_notificationId: '0:15474xxxx',
_sound: 'default',
_subtitle: undefined,
_title: 'Booking',
_android:
{ _notification: [Circular],
_actions: [],
_autoCancel: undefined,
_badgeIconType: undefined,
_bigPicture: undefined,
_bigText: undefined,
_category: undefined,
_channelId: undefined,
_clickAction: 'android.intent.action.MAIN',
_color: undefined,
_colorized: undefined,
_contentInfo: undefined,
_defaults: undefined,
_group: undefined,
_groupAlertBehaviour: undefined,
_groupSummary: undefined,
_largeIcon: undefined,
_lights: undefined,
_localOnly: undefined,
_number: undefined,
_ongoing: undefined,
_onlyAlertOnce: undefined,
_people: [],
_priority: undefined,
_progress: undefined,
_remoteInputHistory: undefined,
_shortcutId: undefined,
_showWhen: undefined,
_smallIcon: { icon: 'ic_launcher' },
_sortKey: undefined,
_tag: undefined,
_ticker: undefined,
_timeoutAfter: undefined,
_usesChronometer: undefined,
_vibrate: undefined,
_visibility: undefined,
_when: undefined },
_ios: { _notification: [Circular], _attachments: [] } }