Question

I need to send push notifications to my app from my server and i am thinking to use urban airship and i am using PHP at back end. As much i got from urban's documentation ,my server need to send message to urban's server and urban's server will forward it to devices

Now ,i want to automate the process of sending of message from my server to urban's server. Actually, at my server, i am executing a script that go through database and fetch list of users to whom message need to send. so please guide me regarding automating sending process.

Was it helpful?

Solution

Yeah, you can use UrbanAirship (UA) for that. They provide a REST API (http://docs.urbanairship.com/connect/index.html) you can use to send to your audience (UA slang for your users).

So you basically just have to

  • use UA SDK in your apps. Basically, they will take off when you start your app, register with Google / Apple for push notifications and give you back a token that you have to store in your database
  • Handle any event where you want to send push notifications in your script
  • get call the data for the users from your database, i.e. the device type (android / ios / windows phone) and the token you received from UA for that user
  • send the data to UA in the way they want it (http://docs.urbanairship.com/connect/connect_send.html) and your good to go

If you want to run your script periodically I would propose just using a CronJob (https://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job) that runs every X minutes / hours / days

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top