how to use firebase admin java sdk to send notification on android by segment country?

115 views
Skip to first unread message

yang ross

unread,
Mar 27, 2023, 1:06:35 PM3/27/23
to Firebase Google Group
hello,
     I can use firebase admin java sdk to send notification which device can receviced android notification successfully, but I have one requirement,  I need to simulate like firebase console to segment country or app version to send notification,  I find the com.google.firebase.messaging.Message.java class, I also checked the github test demo which can set condition in Message like "device.os == 'android' && device.country in ['us', 'uk']", but it throws invalid condition argument exception, please kindly help to fixed this problem, thanks

Arthur Thompson

unread,
Mar 27, 2023, 1:30:35 PM3/27/23
to fireba...@googlegroups.com
Hi Yang,

You can target device characteristics like that from the Firebase console but not from the HTTP v1 API which is what the Admin SDK uses under the hood. This is why you are getting the invalid condition errors.

One option would be to have users subscribe to specific topics related to how you would like to target them. Then use topic conditions for sends.

On Mon, Mar 27, 2023 at 10:06 AM yang ross <ross.y...@gmail.com> wrote:
hello,
     I can use firebase admin java sdk to send notification which device can receviced android notification successfully, but I have one requirement,  I need to simulate like firebase console to segment country or app version to send notification,  I find the com.google.firebase.messaging.Message.java class, I also checked the github test demo which can set condition in Message like "device.os == 'android' && device.country in ['us', 'uk']", but it throws invalid condition argument exception, please kindly help to fixed this problem, thanks

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/be53063f-0f84-4498-9dc9-9da9d5a8f10bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages