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.
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
Post a Comment