4

Как сделать так, чтобы когда приложение в бэкгранде, push уведомление отправлялось не сразу в notification center, а обрабатывалось приложением методом onMessageReceived? Пуш сделано на firebase.

3 ответа 3

1

убрать метод super.onMessageReceived(remoteMessage);

1

Я использую замечательную библиотеку RxFcm, в ней есть классы которые помогут сделать то что вам нужно без особого труда

-1

Отправляйте data-сообщения (без объекта Notification)

With FCM, you can send two types of messages to clients:

  • Notification messages, sometimes thought of as "display messages."

  • Data messages, which are handled by the client app.

Client app is responsible for processing data messages. Data messages have only custom key-value pairs.

Use notification messages when you want FCM to handle displaying a notification on your client app's behalf. Use data messages when you want to process the messages on your client app.

About FCM Messages

3
  • 1
    Постарайтесь писать более развернутые ответы. Поясните, на чем основано ваше утверждение? 12 окт 2016 в 5:38
  • А как можно осуществить отправку data сообщений?
    – Bullshit
    13 окт 2016 в 1:51
  • Из документации "Use your app server and FCM server API: Set the data key only. Can be either collapsible or non-collapsible.", например: { "to": "device_token", "data": { "key": "value" } } 13 окт 2016 в 6:22

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.