0

I have a service that allows user to enter the type of events they like, and whenever a new event that fits those criteria is available in my database, I want them to get a notification.

I have been looking around at the best way to handle it and I have found two possible solutions, but I'm not very clear with which one I should use and how.

First, a solution that looked great was the didReceiveRemoteNotification method and the usage of remote silent notifications to tell the app that new content was available. But my questions remains: how can I send this remote notification to the user if I don't know which criteria he has. I mean, how can I send this notification using PHP? I'm a bit lost here.

So I found another possible solution that does look a lot like a hack (iPhone - Backgrounding to poll for events), to be able to make your app execute a method every XX minutes while it is in background. This would be way more battery consuming and I'm not even sure it would be accepted by Apple, but at least it is clear as to how it works: the app downloads data from a link with the parameters that fit the special criteria, and if there is new data, it sends a notification.

How could I combine both these methods?

EDIT

I think the main issue on my side is that I don't understand how I could check a certain PHP file whenever new data is added into mysql and make sure that it fits the criteria of the user and then send the notification. That is the part that I don't understand in the backend PHP usage.

Community
  • 1
  • 1
el-flor
  • 1,466
  • 3
  • 18
  • 39
  • You will need your backend server to know what criteria the user is interested in and then you can push the appropriate messages when a new event is added to the database. You can do this really easily using a BaaS provider like Parse.com or Azure – Paulw11 Nov 03 '15 at 09:26
  • Thanks for the input. Would you have a specific link? This is a really new concept to me and I'm really not sure how I would have to do this. – el-flor Nov 03 '15 at 09:32
  • Http://parse.com or https://azure.microsoft.com/en-us/services/app-service/mobile/ – Paulw11 Nov 03 '15 at 09:34

1 Answers1

0

Your flow should be like this -

Mobile -> BackendServer(PHP) -> APNS server -> Notifications->Back on device.

User will submit her/his criteria to server then server will process on that and send request to APNS server.

The APNS server will send remote notification on her/his device based on criteria requested.

Vinayk
  • 194
  • 1
  • 8
  • Thanks. What APNS service would you recommend? And how would the APNS server know if new data is entered in mysql? – el-flor Nov 03 '15 at 09:34