0

I need to update my users for things that happened around their current location while the app is in the background.

To my understanding:

  1. If my server sends a Push Notification to a client, the client would immediately show that message.

  2. I can set up the app so that there is a specific location, with a given radius could fire a message.

So what I want to understand if it is even possible to update my users about things that are new in their locations.

I was thinking of two possible solutions, I am not sure they are possible.

One, I guess if the Push Notifications would allow a function to run prior to its display, deciding if the message should appear.

For example: something happened in area x,y - The server initiates a message to all devices. Only the devices within range of x,y and a radius z, would show the message to the users.

Maybe the Regional Monitoring service can send a message to my server and my server can then decide if to send a Push Notification back to the client...

For example

The user has entered a defined location, determined by the app. The app sends a message to the server. The server decides if a message is due. 

Any ideas? is that even possible?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ted
  • 3,805
  • 14
  • 56
  • 98

2 Answers2

1

Filtering push notifications by topic is something you need to do on the server side, not the client side. Apple specifically states not to send messages to users that aren't relevant and you won't be able to block them when the app isn't running. Additionally, if you are using a service to manage your push notifications you don't want to pay for messages that aren't relevant.

So when you register a device into your database, you should register what topics that person is subscribing to (ie. save a list of topics that user is eligible to receive). Then when the event is triggered that generates the push notification only send to devices that are registered to that topic. I believe a number of push platforms have this capability already built in. On UrbanAirship and Azure Notification Hubs you can use their tags feature. Or you can develop it yourself if you do your own push server.

Joel
  • 15,654
  • 5
  • 37
  • 60
  • Good advice, Thanks! @RyanR has suggested to use yet another third party solution. But is there a way other than using channels of interest, which is great, but does not solve the location issue? – Ted Oct 15 '13 at 21:41
  • 1
    http://stackoverflow.com/questions/6347503/how-do-i-get-a-background-location-update-every-n-minutes-in-my-ios-application – Joel Oct 15 '13 at 21:50
1

Take a look at Parse. They have this kind of functionality baked right in, just send the push to clients that match a geoPoint query.

RyanR
  • 7,728
  • 1
  • 25
  • 39
  • I see, and a good point! But how can I tell where is which device? The app isn't updating me while it is off – Ted Oct 15 '13 at 21:31
  • 1
    @Ted If the app is completely 'off', not in the background or suspended, there is no way to get location updates. If it's in the background or has been suspended, you can have your app wake up periodically, process those updates, and notify the server. – RyanR Oct 16 '13 at 00:24
  • Your answer is just as good, as you both addressed my issue and the conventional ways of dealing with it. I'd have to mark Joel's answer just because he was first. So, Thank you nonetheless – Ted Oct 16 '13 at 21:35