views:

290

answers:

1

Hi.. I have an app that ask for user's Location. Then user's location will be send to a server. Since the app that was run on first time on a iPhone will ask for permission, if a user rejects it, the app will keep on asking it on next time until it was allowed (AFAIK); but if the user allows the app to use the location twice, the app will not ask anymore for the user's location at the third time. Seems like it has been stored on preference. My question was how I can keep my application to ask to permission for their Location every time they run my app.

Thanks.

+2  A: 

There's no way to do this with the built-in API. You'll have to put up your own dialog and confirm it.

Ben Gottlieb
If I put my own dialog there will be two. one from the built-in and other one is what I will create.
edie
yeah, so what you'll want to do is track the number of times that you are successful in getting CoreLocation data. If you get it three times, you can assume the built-in dialog is no longer shown, and present your own. This is all theoretical, of course, you should experiment.
Ben Gottlieb
How can I track the number of successful attempts? Should use the NSUserDefaults for tracking the number of success. Does the dialog box that says "APP want to use your current location" returns a value? I want to use that value for the tracker Or what should I need to track it?
edie
maybe you can monitor the AlertView .....
Robin
If I am going to save the number of successfull attempts of getting the CoreLocation data in NSUserDefaults. If I'm going to refer on the value on the user defaults, ex. if (mySuccessfullAttempts > 2) then I can show my AlertView. But If the user reset the Location Warnings in Settings. The app will show the default AlertView and my alertView cause my app will assume that Permission was been saved on the preference; and my NSUserDefaults value was greater than two.
edie
This is by no means a perfect solution, and yes, if the user resets their alerts, they'll get additional messages. However, I think it's as close as you're going to get.
Ben Gottlieb
I think the Settings has some kind of counter or timestamp value for each application that uses the user's location; and this is what the iPhone use to tell if it will show the built UIAlertView. Are there anyways I can access or check the value for this, if ever the iPhone uses it. Do you know something like that on iPhone.
edie
I doubt you can check this value on a non-jailbroken phone.
Ben Gottlieb