Location services alertview - iphone

When we use libraries of location services in our app it automatically show the alert box when we launch the app with don't allow and Ok buttons.
Is it possible to disable the don't allow button? And is there any variable set when we press don't allow or OK button?

Do you mean when the alert asks the user if they want to allow your application to use location services ? If so then no, you cannot override this. This is so that the user is not only aware that their location is benign tracked but also that this data is going to be used by the application. Would you want an application tracking you and potentially uploaded your location without your knowledge ?
As for the variables, pressing yes will tell iOS that it is allowed to track you data, saying no will do the opposite so any maps or locations based services will not be able to retrieve user location.

Related

Photo Library/Camera settings programmatically

I want to enable Camera/Photo library settings for my application. Can i show the alert to enable these programmatically
like when application starts. I have attached picture to show i want to see similar settings for my application
for my application, I am not seeing this settings.
My problem is this application runs in Guided access mode and once user put the application in guided access modes,
application is not getting an iOS alerts , so the default alerts will not come and user will not be able to enable access to photo library.
i have keys description in plist file.
Is there any way i can enable these settings in beginning of application.
No. You can request access programmatically but the request pops up the alert and waits for the user to accept or deny access. There is no way to enable the access without the alert.
If this could be done then it would completely negate the whole point of the user having control over what an app can access or not.
Based on your comments below, you need to know how to programmatically request authorization so the alerts can be responded to.
Use AVCaptureDevice requestAccess(forMediaType:completionHandler:) request access to the camera.
Use PHPhotoLibrary requestAuthorization(_:) to request access to the photo library.
For a better UX, don't make the 2nd request until the 1st one is complete.

Allowe location services again programmatically

I have disabled location services on Safari (iphone) when I load my web clicking on "Not allow". How can I allow it again for the same web page (programmatically)
Best regards
You can not change user preferences programmatically. You can simply check if location services are on and your application has access to services if not prompt user to allow location services to use this feature in your app.
You can't, you will have to go in to the settings app and enable it there.
(if you want your app on Appstore) Programmatically you can not call that dialog which asks you for location services permission.
manually go to Settings -> General, scroll to the bottom and go to Reset-> Reset Location & Privacy.

iOS, CLLocationManager: Displaying the "reenable Location Services" Popup

if location services are turned off (after the user once did allow the service) and you then start location updates, a system popup should appear. (the documentation says so in the description of [CLLocationmanager locationServicesEnabled])
But if I setup a test project, which just initialises a CLLocationManager and then calls startLocationUpdates, the popup does NOT appear on every app start. But it should if I understand the documentation right?
I am not talking about the first popup, which asks the user to allow or deny location use for that app. I am talking about the popup, which asks the user to reenable the location services in the settings. That popup has a direct button to the settings application. You can see it, if you disable location services and than open up the maps app. Everytime you press the locate-me button now, the popup appears. Screenshot:
I want it to show up reliably on every app start in case the services are disabled. (other apps do it the same way, e.g. aroundme)
Thanks, Markus
The Popup will only appear once (in some cases twice) for the lifetime of an app!
That is the result of my tests. If anyone has additional information, feel free to write / contact me!
Thanks.

pass location parameters to registered location services application

I need to add the following feature to my iphone application.
When user taps a button I need to show a list of applications that work with maps/navigation/location (that can show him how to get from his current location to the destination point). When user chooses any application from this list my applicationn sends parameters (destination point) to it and opens it.
for example. user presses a button an then he sees the list of registered location services applications:
- google maps application
- navigate application
- iGo application
- some other application's
then user chooses "google maps application", for example. Then my application have to open google maps application with the parameters (destination point) passed to it.
So user can see the path (how to get) from his current location to the destination point inside google maps application
It could be done for android, what about iphone?
Unfortunately, It could not be done normally on ios

Is it possible to call alert "Allow to use current location" manually?

Is it possible to call alert "Allow to use current location" manually when using CoreLocation framework?
No, it's automatically displayed when the app accesses Core Location. If the user rejects it, it's displayed a second time at the next launch, then it keeps quiet and isn't shown anymore.
See this answer how to detect if the user rejected the request.