How can I send a silent notifications using app center push service
Asked Answered
C

4

6

I am trying to send a silent notification (I mean a notification that will not be shown in the tray) using this API:

but when I do not set the body key I get this Error:

 {
  "error": {
    "code": 400,
    "message": "body parameter is invalid or empty.: 'Body' cannot be null."
  }
}

so my question is if there is a way to send a silent notification in android (in ios I know there is the content-available flag)

Tnx in advance!

Colloid answered 7/3, 2018 at 15:23 Comment(4)
use data node instead of notification node of body. firebase.google.com/docs/cloud-messaging/concept-optionsSuperconductivity
I see Sarahm is using AppCenter API and not directly FCM. @killer, is this will work via the AppCenter API?Calamint
my bad I didn't understand the question clearly.Superconductivity
Is is possible to use Firebase API directly? I tried, but without any luck, seems that I have to set up firebase in app separatelyProtective
U
4

Unfortunately silent notification is not yet supported on App Center for Android.

Upstage answered 7/3, 2018 at 19:6 Comment(5)
Thanks @Guillaume, you were 100% right. I just got the confirmation from your support (that was not aware of that limitation) "Unfortunately, I just confirmed that it is currently unavailable for Android. Guillaume is indeed one of the engineers on our team and is a great source of information. I understand it is something we will be working on but no ETA at the moment."Calamint
@Guillaume thank you for the information! Is there any update about ETA for silent notification support on App Center? Are there any workaround at the moment?Protective
Any eta ? This seems an important feature.Unilateral
Hi, for feature requests I would recommend contacting the team on the chat support from any page of appcenter.ms.Upstage
Can you add this somewhere in the docs? I went through the whole SDK setup process and now I have to use to Firebase anyways...Djokjakarta
C
4

I've asked AppCenter support via their live chat and they replied me the following

You can by setting “content-available” key in the custom data. here is a sample payload you need to set in body:

“notification_content” : {  
   “name” : “name of Push”,  
   “custom_data” : {“content-available” : “1”}  
},
Calamint answered 8/3, 2018 at 6:54 Comment(2)
I've asked if this is documented and they replied that their documentation is not yet completCalamint
I tried it for Android, but it's not working - my app still displays notification in tray.Protective
V
0

Indeed,

“notification_content” : {
“name” : “name of Push”,
“custom_data” : {“content-available” : “1”}
},

is for silent push notifications in ios

Vase answered 10/4, 2018 at 19:47 Comment(1)
is there any additional set up to handle silent push messages? I tried to send message as you described, but my callback is not triggeredProtective
F
0

Try this for Android and iOS

{
  "notification_target": {
    "type": "devices_target",
    "devices": [
      "43533adc-4133-4121-ad4e-1eb4885b4b98"
    ]
  },
  "notification_content": {
    "name": "edd3-43ef-91f5-276c28a86517",
    "title": "",
    "body": "",
    "custom_data": {
      "content-available": "1",
      "id": "your data"
    }
  }
}
Fibrin answered 8/7, 2019 at 22:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.