I am still a bit undecided here. Because as Gert Vanwijn replied at one of my blog posts. It would be nice to let the application decide whether or not the notification is intended for the user or not (if he is near enough to the victim. It would save a lot of battery and the server should have to do less calculations. However I don’t if it is possible to intercept the notification in your application before showing it to the user. Because the whole point of the notification is that the application doesn’t have to run in the background, but if it isn’t running how can it handle the notification? I read this tutorial:
And it says:
And when an event of interest occurs, the server-side component can send the app a push notification! There are three things a push notification can do:
Display a short text message
Play a brief sound
Set a number in a badge on the app’s icon.
So I don’t really know if that is possible, but I will look into that some more.
But if you know how I would like to hear about it because indeed that would be better!
The other approach is deciding server side who gets a notification. This will mean the user will have to push their location to the server on regular basis. So that application will have to run in the background. I am still undecided on the number of people I will want to notify. But for example I want to notify 30 people. I will send the 30 people whose current location is the closed to the victim. However it might be so that we don’t reach 30 people. This can be because the last update was too old and not representative anymore. People might have closed the application unaware we need their actual location or just turned off there GPS to save battery. What I want to do then is use there profile settings. As I mentioned in my presentation I studied other projects and many of them use the profile settings of the user to know where they are. That’s what I wanted to do as well if we don’t reach to number we set using the current location. So in their profiles they will have to state where they work or live and when they’re there.
So first take the current location if we don’t reach enough people look at where they work or live and send those people a notification as well until we reach the desired number.