Tuesday, November 18, 2014

Push notifications on APNS , GCM and MPNS(WNS)

If you need to send Push Notifications for your application you will realize that you need to support a number of device types( ios, windows, android to name a few)

Its interesting how push notification differ and resemble on these different platforms.

One option is to use things like urbansirship and outsource the job.

The other option is to build on free python libraries to send messages to apps like pushco, nma(notify my android), growl(windows)  e.t.c


But if you need to send pushnotifications to your applications things are different.

You will need to look into APNS, GCM/C2DM, MPNS/WNS  e.t.c  (follow the links for details on them) and if you are looking for a python library for windows notification https://github.com/Neetuj/python-wns


I will be concentrating on the sending part of the push notification in this post.
....more to come



Comparision of  pushnotification  on different platforms(apart from the attachment):-


ID:-
      GCM:-  Android requires the device to contact its respective push message provider (GCM ) to receive a special string Device ID   identifies a specific app on a specific device. 183-byte string [a-zA-Z0-9_\-]
      APNS:-  ios requires the device to contact its respective push message provider (APNS ) to receive a special string Device token,  identifies a specific app on a specific device.64-byte hex-string
      MPNS:-  Windows requires the device to contact its respective push message provider (MPNS ) to receive a special string URI,  identifies a specific app on a specific device.


Message:-
        GCM:- json paylaod  (registration_ids, data=None, collapse_key=None, delay_while_idle=False, time_to_live=None, is_json=True, dry_run=False)
        APNS:-string or dictionary (alert (body, action-loc-key,loc-key,loc-args,launch-image)  , sound, badge,  token)
        MPNS:-string

Feedback:-
        GCM:- return success/failure
        APNS:- no response .. listen to APNs feedback server for deprecated tokens
        MPNS:- http_status_code will be returned for success/failure

Limitations:-
        GCM:- payload size<=4 KB
        APNS:- payload size<=256 bytes (alert 75-100 bytes)  ios8+ it was increased to 2 kb
        MPNS:- payload size<=3kb

Customized data:-
        GCM:- send in json message
        APNS:- "extra" key is there is space
        MPNS:-  "param" key (string)





Side note:- APNS disconnects if there are failures so listen to feedback server and try to get a persistent connection




more here (http://csce.uark.edu/~cwt/COURSES/2014-01--CSCE-4543--SW-ARCH/03--CHAPTERS/Chapter%2004--Push%20Notification%20Services--Cleaver.pdf)






1 comment:

  1. If you are looking for a library to send pushnotifications to windows here is the post

    http://workstuffcareer.blogspot.com/2015/08/python-wns-to-send-puch-notifications.html

    ReplyDelete