These days I am working with a News publishing App and I am involved with the Back-end API of it. Since now we are very last stage of the development we started adding the push notifications for the App, hence I had to come up with a solution when a WordPress post published then and there to trigger and event to send push notifications for the Android and iOS devices. Then while experimenting WordPress functions I came up with this solution, which is very handy and I believe it will be useful for anyone wants carry out features as such.

BTW, If you think there are better way to handle this, please let me know. Always improvements are great for the apps which deals with million users right?

Please find the gist from https://gist.github.com/yoosuf/3890f3789754afe65525