Adding Graphics and Emoji characters to Apple push notifications

In this article, I’m going to show you how you can add some graphics to your Apple Push Notifications.

Basically you can’t add custom images to your payloads, because payloads are Json formatted strings and Json does not support binary data, but you can still add some Unicode characters called Emoji characters.

This will work on all IPhones since firmware 2.2 and there is no need to install any additional application on IPhone to use them. All you need to do is aading these characters including the forward slash in your message section of payloads.

Bellow is a full list of Emoji characters and their image:

e415\ue415 e056\ue056 e057\ue057 e414\ue414 e405\ue405 e106\ue106 e418\ue418
e417\ue417 e40d\ue40d e40a\ue40a e404\ue404 e105\ue105 e409\ue409 e40e\ue40e
e402\ue402 e108\ue108 e403\ue403 e058\ue058 e407\ue407 e401\ue401 e40f\ue40f
e40b\ue40b e406\ue406 e413\ue413 e411\ue411 e412\ue412 e410\ue410 e107\ue107
e059\ue059 e416\ue416 e408\ue408 e40c\ue40c e11a\ue11a e10c\ue10c e32c\ue32c
e32a\ue32a e32d\ue32d e328\ue328 e32b\ue32b e022\ue022 e023\ue023 e327\ue327
e329\ue329 e32e\ue32e e32f\ue32f e335\ue335 e334\ue334 e021\ue021 e337\ue337
e020\ue020 e336\ue336 e13c\ue13c e330\ue330 e331\ue331 e326\ue326 e03e\ue03e
e11d\ue11d e05a\ue05a e00e\ue00e e421\ue421 e420\ue420 e00d\ue00d e010\ue010
e011\ue011 e41e\ue41e e012\ue012 e422\ue422 e22e\ue22e e22f\ue22f e231\ue231
e230\ue230 e427\ue427 e41d\ue41d e00f\ue00f e41f\ue41f e14c\ue14c e201\ue201
e115\ue115 e428\ue428 e51f\ue51f e429\ue429 e424\ue424 e423\ue423 e253\ue253
e426\ue426 e111\ue111 e425\ue425 e31e\ue31e e31f\ue31f e31d\ue31d e001\ue001
e002\ue002 e005\ue005 e004\ue004 e51a\ue51a e519\ue519 e518\ue518 e515\ue515
e516\ue516 e517\ue517 e51b\ue51b e152\ue152 e04e\ue04e e51c\ue51c e51e\ue51e
e11c\ue11c e536\ue536 e003\ue003 e41c\ue41c e41b\ue41b e419\ue419 e41a\ue41a
e04a\ue04a e04b\ue04b e049\ue049 e048\ue048 e04c\ue04c e13d\ue13d e443\ue443
e43e\ue43e e04f\ue04f e052\ue052 e053\ue053 e524\ue524 e52c\ue52c e52a\ue52a
e531\ue531 e050\ue050 e527\ue527 e051\ue051 e10b\ue10b e52b\ue52b e52f\ue52f
e528\ue528 e01a\ue01a e134\ue134 e530\ue530 e529\ue529 e526\ue526 e52d\ue52d
e521\ue521 e523\ue523 e52e\ue52e e055\ue055 e525\ue525 e10a\ue10a e109\ue109
e522\ue522 e019\ue019 e054\ue054 e520\ue520 e306\ue306 e030\ue030 e304\ue304
e110\ue110 e032\ue032 e305\ue305 e303\ue303 e118\ue118 e447\ue447 e119\ue119
e307\ue307 e308\ue308 e444\ue444 e441\ue441
e436\ue436 e437\ue437 e438\ue438 e43a\ue43a e439\ue439 e43b\ue43b e117\ue117
e440\ue440 e442\ue442 e446\ue446 e445\ue445 e11b\ue11b e448\ue448 e033\ue033
e112\ue112 e325\ue325 e312\ue312 e310\ue310 e126\ue126 e127\ue127 e008\ue008
e03d\ue03d e00c\ue00c e12a\ue12a e00a\ue00a e00b\ue00b e009\ue009 e316\ue316
e129\ue129 e141\ue141 e142\ue142 e317\ue317 e128\ue128 e14b\ue14b e211\ue211
e114\ue114 e145\ue145 e144\ue144 e03f\ue03f e313\ue313 e116\ue116 e10f\ue10f
e104\ue104 e103\ue103 e101\ue101 e102\ue102 e13f\ue13f e140\ue140 e11f\ue11f
e12f\ue12f e031\ue031 e30e\ue30e e311\ue311 e113\ue113 e30f\ue30f e13b\ue13b
e42b\ue42b e42a\ue42a e018\ue018 e016\ue016 e015\ue015 e014\ue014 e42c\ue42c
e42d\ue42d e017\ue017 e013\ue013 e20e\ue20e e20c\ue20c e20f\ue20f e20d\ue20d
e131\ue131 e12b\ue12b e130\ue130 e12d\ue12d e324\ue324 e301\ue301 e148\ue148
e502\ue502 e03c\ue03c e30a\ue30a e042\ue042 e040\ue040 e041\ue041 e12c\ue12c
e007\ue007 e31a\ue31a e13e\ue13e e31b\ue31b e006\ue006 e302\ue302 e319\ue319
e321\ue321 e322\ue322 e314\ue314 e503\ue503 e10e\ue10e e318\ue318 e43c\ue43c
e11e\ue11e e323\ue323 e31c\ue31c e034\ue034 e035\ue035 e045\ue045 e338\ue338
e047\ue047 e30c\ue30c e044\ue044 e30b\ue30b e043\ue043 e120\ue120 e33b\ue33b
e33f\ue33f e341\ue341 e34c\ue34c e344\ue344 e342\ue342 e33d\ue33d e33e\ue33e
e340\ue340 e34d\ue34d e339\ue339 e147\ue147 e343\ue343 e33c\ue33c e33a\ue33a
e43f\ue43f e34b\ue34b e046\ue046 e345\ue345 e346\ue346 e348\ue348 e347\ue347
e34a\ue34a e349\ue349
e036\ue036 e157\ue157 e038\ue038 e153\ue153 e155\ue155 e14d\ue14d e156\ue156
e501\ue501 e158\ue158 e43d\ue43d e037\ue037 e504\ue504 e44a\ue44a e146\ue146
e50a\ue50a e505\ue505 e506\ue506 e122\ue122 e508\ue508 e509\ue509 e03b\ue03b
e04d\ue04d e449\ue449 e44b\ue44b e51d\ue51d e44c\ue44c e124\ue124 e121\ue121
e433\ue433 e202\ue202 e135\ue135 e01c\ue01c e01d\ue01d e10d\ue10d e136\ue136
e42e\ue42e e01b\ue01b e15a\ue15a e159\ue159 e432\ue432 e430\ue430 e431\ue431
e42f\ue42f e01e\ue01e e039\ue039 e435\ue435 e01f\ue01f e125\ue125 e03a\ue03a
e14e\ue14e e252\ue252 e137\ue137 e209\ue209 e154\ue154 e133\ue133 e150\ue150
e320\ue320 e123\ue123 e132\ue132 e143\ue143 e50b\ue50b e514\ue514 e513\ue513
e50c\ue50c e50d\ue50d e511\ue511 e50f\ue50f e512\ue512 e510\ue510 e50e\ue50e
e21c\ue21c e21d\ue21d e21e\ue21e e21f\ue21f e220\ue220 e221\ue221 e222\ue222
e223\ue223 e224\ue224 e225\ue225 e210\ue210 e232\ue232 e233\ue233 e235\ue235
e234\ue234 e236\ue236 e237\ue237 e238\ue238 e239\ue239 e23b\ue23b e23a\ue23a
e23d\ue23d e23c\ue23c e24d\ue24d e212\ue212 e24c\ue24c e213\ue213 e214\ue214
e507\ue507 e203\ue203 e20b\ue20b e22a\ue22a e22b\ue22b e226\ue226 e227\ue227
e22c\ue22c e22d\ue22d e215\ue215 e216\ue216 e217\ue217 e218\ue218 e228\ue228
e151\ue151 e138\ue138 e139\ue139 e13a\ue13a e208\ue208 e14f\ue14f e20a\ue20a
e434\ue434 e309\ue309 e315\ue315 e30d\ue30d e207\ue207 e229\ue229 e206\ue206
e205\ue205 e204\ue204 e12e\ue12e e250\ue250 e251\ue251 e14a\ue14a e149\ue149
e23f\ue23f e240\ue240 e241\ue241 e242\ue242 e243\ue243 e244\ue244 e245\ue245
e246\ue246 e247\ue247 e248\ue248 e249\ue249 e24a\ue24a e24b\ue24b e23e\ue23e
e532\ue532 e533\ue533 e534\ue534 e535\ue535 e21a\ue21a e219\ue219 e21b\ue21b
e02f\ue02f e024\ue024 e025\ue025 e026\ue026 e027\ue027 e028\ue028 e029\ue029
e02a\ue02a e02b\ue02b e02c\ue02c e02d\ue02d e02e\ue02e e332\ue332 e333\ue333
e24e\ue24e e24f\ue24f e537\ue537
I hope this helps you add more color to your Push notifications.
same as usual email me on or leave a comment for me if you have any questions. I will be more than happy to assist you.

iOS Push Notifications in C# with Moon-APNS

I have been busy developing backend of an IPhone application which is sending considerable number of push notifications twice a day. Trying to fix some issues and bugs on other free and open source c# push notification libraries I came up with the idea of writing my own c# library and as a big fan of open source I’m going to share the library on GitHub.

The library is called Moon-APNS and it can be downloaded from here.

This is the first version of the library, but It has been tested under pressure and on a production version of an application so feel safe to plug it to you application. Moon-APNS can be used in any .net application web or windows based.

Moon-APNS is benefiting from new Apple Push Notification structure, called Enhanced Push Notification. Which enables the library to receive feedback on each notification sent to apple server asynchronously, you may say we can receive that response with apple feedback service, but unfortunately if you send a payload to apple server with wrong format, broken or missing device tokens apple will terminate the connection straight away and it’s really hard to figure out which one was the faulty payload when you are sending them one after each other because it takes up to 2 seconds for the connection to be closed. Using Enhanced push notification you can sign each payload with a unique identifier and even better you can set TTL on each payload so apple know how long they should try to deliver the push notification before it expires. Moon-APNS will send payloads and receive feedback asynchronously and will re connect and resume sending the queue in case of any errors. All device tokens of rejected payloads will return as a list when the queue is sent and feedback is received from apple with error code sent by apple so you will know why the payload was rejected.

In Moon-APNS I’m using free and open source NLog library to log all events happening behind the scene which makes it really easy to debug the application while you are on production and you can’t attach a debugger.

Sending Apple push notification has never been so easy with Moon-APNS you will need less than 10 lines of code to send push notification and receive the feedback.

Ok enough talking I think it’s time for some coding.

1) You should generate your payloads:

 1:  var payload1 = new NotificationPayload("DeviceToken","Hello !",1,"default");

Feel free to add custom parameters to your payload as bellow:

 1: payload1.AddCustom("CustomKey", "CustomValue");

2) Moon-APNS accepts a list of payloads, so I will add my payloads to a List:

 1: var notificationList = new List {payload1, payload2, payload3};

3) create an instance of Moon-APNS push notification class, and pass true or false for using sandbox, location of your p12 file, and password for thep12 file if you have one and blank string if you don’t have one.

 1: var push = new PushNotification(false, "P12File location","password");

4) Create a list for your feedback, returned from library which will contain rejected payloads list.

5) Saved best for last call SendToApple method and pass list of your payload.

 1: var rejected = push.SendToApple(notificationList);

Is that all? Well yes it is! So if we ignore lines for generating payloads I can say we are sending push notification ad receiving feedback in 2 lines of code. Everything you need to do is handled by Moon-APNS library for you so you can have more time to consider on your application logic.

Feel free to email me or post your questions as a comment and I’ll be more than happy to assist you as much as I can.

This is the first version and I will commit new builds with new features soon.