android - Firebase Notification when application is close (Issue) -


everybody, m using firebase receive push notification server. working fine when application running. got notification, handle , show on notification tray. seems perfect. here code.

public class firebasepushservice extends firebasemessagingservice {     private static final string tag = "firebase main service ";      @override     public void onmessagereceived(remotemessage remotemessage) {         log.d(tag, "got message: " + remotemessage.getfrom());         try {             if (remotemessage != null && remotemessage.getnotification() != null                     && remotemessage.getnotification().getbody() != null) {                 string body = remotemessage.getnotification().getbody();                  log.d(tag, "from: " + remotemessage.getfrom());                 log.d(tag, "notification message body: " + body );              }         } catch (jsonexception e) {             e.printstacktrace();         }       }} 

manifest code.

 <service android:name="app.asparagus.com.asparagus.firebase.firebasepushservice">             <intent-filter>                 <action android:name="com.google.firebase.messaging_event" />             </intent-filter>         </service> 

. issue when application closed. no log works of class, nothing. here interesting part. can see whole json server, , shown on notification tray ( whole json object displayed). not getting what's wrong in code. check image. 1- success case. enter image description here

2- unknown issue caseenter image description here

from link, think message should contain both notification , data payload.

or maybe can set priority of message high one

{   "to" : "bk3rnwte3h0:ci2k_hhwgipodkcizvvdmexudfq3p1...",   "priority" : "high",   "notification" : {     "body" : "this week's edition available.",     "title" : "newsmagazine.com",     "icon" : "new"   },   "data" : {     "volume" : "3.21.15",     "contents" : "http://www.news-magazine.com/world-week/21659772"   } } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -