Skip to content
Advertisement

How to send Apple push notification to specific users

I have managed to get push notifications working but I have trouble on how to send notifications to specific users. Perhaps using a customer number or name etc. I don’t know where to even start. I have spent weeks reading hundreds of web sites and I can’t seem to work it out.

These are just a few of the pages I’ve looked at:

Here is my objective-c code in Appdelegate – Sorry if it’s not great I have pieced it together from several posts.

JavaScript

Here is the server side PHP code

JavaScript

This is all working but how to I send it to a specific user?

Advertisement

Answer

You can send push notification to a selected device token.

Before sending follow these steps:

iOS Application side

  • On application launch get device token in didRegisterForRemoteNotificationsWithDeviceToken delegate
  • Send this token to server using API when user login in the application

Server side

  • Store this token in db table corresponding to the user id
  • Get device token from db corresponding to the user to whom you want to send notification
  • Send notification on that token
  • Notification will be received on device
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement