android - How to get 'to' field in firebase could messaging JSON? -
i can succesfully send firebase cloud messages android sample project. described in here, apply step 2 , works far.
my json body:
{ "to": "/topics/testtopic", "data": { "key1" : "val1", "key2" : true } }
has data field can access in onmessagereceived() method:
@override public void onmessagereceived(remotemessage remotemessage) { string toval = remotemessage.getto(); map<string, string> data = remotemessage.getdata(); }
but getto() method gets null. how can access 'to' field in originating json?
i expecting have "/topics/testtopic"
in im variable toval.
i think you're looking remotemessage.getfrom()
:
get sender of message.
this sender id or topic topic messages.
Comments
Post a Comment