arleyandrada / PushClient

FREE and Open Source - Titanium PushClient Module
Other
44 stars 17 forks source link

Silence Push #100

Closed nubu closed 8 years ago

nubu commented 8 years ago

Hey,

is it possible to use this with android & iphone silent Push? On ios i have to do the "magic" on the server i guess, but on android? Any idea?

arleyandrada commented 8 years ago

Hi Nabu,

Yes, it is possible and easy to use silent notifications on iOS or Android.

With my push notification module, on Android, just sent a payload data without "alert" or "text" attributes.

On iOS, just sent a payload data without "alert" or "text" attributes, include the "content-available" attribute and set the UIBackgroundModes at tiapp.xml.

Unfortunatelly there is a limitation on Android and my module: silent notifications will works only when the app is running / started (in foreground or background).

Sample JSON payload for Android:

{
"my-custom-data" : "some-value"
}

Sample JSON payload for iOS:

{
"content-available" : 1,
"my-custom-data" : "some-value"
}

To enable iOS background push notification, set the UIBackgroundModes in tiapp.xml

    <ios>
        <plist>
            <dict>
                .....
                <key>UIBackgroundModes</key>
                <array>
                    <string>remote-notification</string>
                </array>

That's all!

Regards,

Arley