Is there a way to send "silent" push notifications to user? (Unity - Android and iOS)

0 votes
Does BaaS offer a service similar to GCM send-to sync messages? I would like to detect in a runtime application without making an api call, that a friend send me a message. User receiving a message should not be aware of the message being received.

What do you think is the best way to implement this functionality?

Thank you for you answer!
asked Mar 3, 2015 in App42 Cloud API-BaaS by kraner (43 points)
edited Mar 3, 2015 by kraner

1 Answer

+1 vote

Hi Kraner,

Yes, there are way around for both the platform to receive a silent push.

iOS: To make a push silent you  need to send "content-available" key with value 1 but you should not send "alert", "sound" and "badge" key. You can send your own custom key-value along with "content-available" key as follows:

{"content-available":1,"message":"Hello to silent push"}

This push will be received silently and you can manage your custom key in the delegate method that will be called when push arrived.

Android: In this case, you have to handle the push received by your self at client side.

You can use above json format here as well but while parsing the json make validation before generating notfication on the basis of "content-available" in your android service that handles the received push messages. When the json has "content-available" key with value 1, dont generate the push notification.

Let us know if you have further queries.

answered Mar 4, 2015 by rajeev.etc (1,660 points)
Hi, I'm using push notification on Unity Android. I can't figure out how to make silent push. I tried to send a JSON push with this content from AppHQ:
{"content-available":1,"message":"Hello to silent push"}
I receive it on the Android device but the whole JSON shows in the push notification.

What do I have to do on the client side ?
(In my Unity code I can process the JSON message, but I don't want it displayed in the push notification outside of the Unity app).

In your post you say "make validation before generating notification in your android service that handles the received push message". I am not sure I understand this part. Is there some documentation or sample code for that?
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...