Ask iOS to execute an app or services periodically - iphone

I'd like to have a game in which everytime one of your friends beats your highscore, it sends you a notification.
There is many ways to do it. But I would like to know if there is a way to "ask" your iphone to call one of your applications or services which then contains the code that checks the leaderboards and push a notification if needed.
Not sure if this is clear enough ;p
Thank you for your help

If you want to try something like this..then you must do this from within the app. .that is system won't tell your app to check codes.. you open the app and then press a button or something to check leader boards.
So there is no way to ask your iPhone!
best way is to have an option in within the app through which user confirms that he wants to receive notifications on high score beaten..then you keep his high score on your server..and if someone breaks that.. post a notification from your server.

Your highest score must be stored somewhere. If you store it on your server, then you can use web services so that every time the user got a highest mark(on his/her iPhone), send a web service request to the server and get the results back.
On the server side, all you have to care is creating a user's friend list and the highest score of every player.
Hope this helps.

Related

Is it possible to save a custom variable for each user on their account?

I just got starte with programming a Facebook app. I already wrote an app for the VZ-Network, and there they have something called 'Persistant Storage'. Basically its an environment where you can save custom data on each user account. With your app you can read this data from the current user as well as from the users friends. Now I want to port my app to Facebook and my problem is that I didn't find such functionality here yet.
For now I would like to finish and launch this as soon as possible, so it would be nice if I could c&p as much of the code as possible.
Since the data is contains information about participation, at some point I would like to use the Facebook event object. But I was wondering if that could cause problems since it would require to create those events publically in order to use them in my app. Couldn't that lead to legal problems when I create such events with those who actually host the events in the real world? Would I have to ask the hosts to create those events, could I automate this process, or in case they don't have a Facebook account ask them to approve that the app creates the event for them?
I also need to know in what events the users friends participate, so I can't simply save the information on my server, since I don't have the friend info there.
In any case, it seems much easier to me to simply use a list of EventIDs on each user account to check whether or not the user participates in an event.

Facebook APP alerts - The same thing as app requests?

I've used 'Are You Interested', a Facebook APP and when something on that app happens (such as a user sends me a message in that app) then I will see (to the left under APPS) a numeric value representing the number of new events that have happened on 'Are You Interested' since I last looked.
I want to do the same thing with my App, as it's also a niche dating site. I'd like to notify users when someone sends them a message or views their profile. I was told that I should search for app requests. However the code samples that I see seem to be slightly different than what I want to accomplish.
The information I am finding seems as though it is intended for me to allow my users to request things from their friends. That's completely different than what I want to do. There's no need for them to request anything from friends.
When I tried sending one to my test account, just to see what happens..it incremented the numeric value to the left under APPS by 1, which is a good thing, but the text was so generic, it was something like, "So and so is requesting something in [sitename]", but I don't want it to say that and I didn't see anywhere to change this text....furthermore, it added a 'Notification' to the very top of Facebook with the same generic request message. Again, that's not what I'm looking for. When I receive these APP Alerts for other apps, they don't add a 'Notification' up top of Facebook, and I don't want to either. I do believe that the code snippets I found under 'Requests' is something different than what I'm looking to achieve.
Just to summarize: I have a dating app, and people can send messages to eachother. I want an APP Alert (as I'm referring to it) to be seen to the left under Apps and also to the right in the bookmarks area, but I want the message to not be so generic and I don't want users to be selecting friends to request something. I want this action to come from my server and sent to the user that will be receiving the alert. I also do not want a facebook 'Notification' up top each time they receive a message. I hope I'm being clear in what I'm trying to accomplish. Thanks in advance for any guidance. -Chris

Check user location before they see Push Notification Message?

Would someone happen to know a small code sniplet to get and compare the users location before they see a push message inside the appDelegate class?
If the app isn't running, then you can't 'get in the way' the message will be displayed to the user. And where I say running I mean in the foreground and with the screen on.
If the app is running, then you can embed arbitrary information (such as a relevant location) with the push notification payload. When this is delivered to your app's delegate, you can check for their location as you normally would, and if the user is where you'd like them to be you can pop up a message to them.
It seems like a lot of hard work for people that are actually using the app at the time that the notification is delivered though. What will you do about all the users who aren't running the app and get the push notification popup without the check?

How to obtain ongoing user consent for use of location info

In my application, I'm using location information to capture the user locations.
I have the following questions:
What are the alert messages we have to provide in the application for user to show that we are going to use their location?
Can we fetch the location info in the background once the user accept that?
If user is allowed to fetch the location information let's say in the first time the application launches, do we need to provide the alerts for consecutive fetches (in next app loads)?
Thank you.
None, iOS will do this automatically.
This is the normal procedure.
iOS will bug the user as it is programmed to do.
If you assign the purpose property to your location manager instance, it will include that in the popup that asks the user for permission. See http://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/doc/uid/TP40007125-CH3-SW30
Yes for the other two.
I'm not an iPhone programmer, but I'm an iPhone user. Every time an application has asked for access to my location information, once I say yes it never asks again and regularly uses it.
This leads me to believe that the answer to your questions is:
1) Probably the alert message is provided automatically the first time your application requests location information. I'm pretty sure they aren't relying on developers policing themselves.
2) Yes, I believe so.
3) Yes, I believe so.

Availability of Push notification service in this situation?

i'm working on a football application. the application connects to a webservice and gets the required data via soap request whenever a tab is opened. one of the tab shows live matches of the current day. when the live tab is opened, it refreshes the view by a timer and shows the status updates (goal scored, half time or full time). what i need to do is getting the status updates when the app is closed. the user will select max 2 competitions from settings of the app. then the status updates about these 2 competitions needed to be alerted. can i use push notification service to send soap requests and make alerts according to the response? or does it only allow getting response? or is there anyway that i can do it?
thanx in advance.
I'm not entirely clear what you are asking. The part where you write:
can i use push notification service to send soap
requests and make alerts according to the response?
or does it only allow getting response?
isn't really clear to me. What response are you talking about?
In any case.. push notification is what is says. It pushes a notification to the iPhone.
It does not:
activate your application in the background
allow for any action of your application without the user opening said application first
allow any kind of data to be gather from the phone
If you want the user's phone to talk to your server, the user will need to open your application. If that's what you're asking.