Request know their location after his deny it - ios

I'm requesting know the user location (in an iOS App), but if he Deny it, I'm redirecting to other page, but this preference is stored in some place and the app is not requesting any more his location.
Exist a way to show again the popup requesting know the location again?

No, you only get one chance to ask for the users location.
Once that is done the user has to toggle it in the phone settings under "Location Services".

Related

Expo - How to get location permission specific data?

I'm working with Expo SDK 42 and I'm having some problems retrieving specific data about the foreground location permission.
For ios, for example, when the user gets asked for permission, he gets 3 options: "allow once", "allow while using the app" or "don't allow".
The permission is being asked using the following method according to the documentation: requestForegroundPermissionsAsync(). So after requesting it, if the user selects "allow once" or "allow while using the app", that method will return exactly the same object, which contains a property telling that the permission is 'granted', and there's no difference in the return value if the user selected one option or the other.
The problem is, I need to know and differentiate if the user selected "allow once" or "allow while using the app" because, based on that, I will show a different screen.
Do you know if it's possible to do that with Expo? If not, is there a workaround or something I can do to know what option was selected by the user?
Thank you.
The short answer is it isn't possible to differentiate between "allow while using" and "allow once", and your app really shouldn't need to anyway. If the user selects "allow once" then your app will just ask for access again the next time it launches.
Essentially your app needs to handle three states:
Location access not determined
Location access granted
Location access denied.
Initially your app will have the not determined state. In response you request location access. If the user selects "allow" or "allow once" you will get an access granted state.
If they selected "allow once" then the status will return to "not determined" the next time your app launches and you need to ask again.
If they select "allow while using" or "deny" then that state is what your app will see on subsequent launches unless the user goes into the settings for your app and changes it.

Can I get location access without generating the default popup in iphone?

I am working on an app that requires location access. I created a view controller asking the user to allow or not with 2 buttons. But when I click the allow button, device is generating it's own popup asking the user for location access. Can I avoid the popup and just add the functionality of allow in popup into my code for the allow button in my app itself?
No you cannot avoid system popup. As per apple
Always request authorization at the point where you actually plan to
use location services to perform a task. Requesting authorization may
display an alert to the user. If it is not clear to the user that your
app is using location services for a useful purpose, the user may deny
your request to use those services.
Also, It is safe to start location services before the authorization status of your app is determined. Although you can start location services, those services do not deliver any data until the authorization status changes to authorizedAlways or authorizedWhenInUse. To be notified when the authorization status changes, implement the locationManager(_:didChangeAuthorization:) method in your location manager delegate.
Sorce
No, Not possible in Apple device yet.

iOS Location Services Alert - What is the delay between showing it?

Just a quick question here.
I am displaying the the alert for the user to allow the app to access location data, and I have this triggered from a switch.
When the user turns the switch on, the alert will be displayed.
If the user clicks disallow, is there a time restriction that Apple has before you can show that alert again?
Thanks in advance!
Once the user chooses not to give your app permission to access their location data, the user will not be able to grant your app that permission from within your app. Instead, the user must enter the Settings app and grant the permission from there. This is to prevent the app from bombarding the user with requests to use location data.

Programmatically request location updates permissions

How do I programmatically request location updates permissions?
I mean, I what to control, when does the native popup asking for "Your current location" pops
purpose:
I what to control that if there is no permissions, to present something and only then to ask for them (apple native popup). How to that?
You don't control the "Apple native popup".
You know whether the desired services are available through CLLocationManager class methods (locationServicesEnabled, authorizedStatus, etc). If location services are switched off, you can just start using a location manager anyway (e.g. startUpdatingLocation) - that is your only way of getting the system dialog asking the user to switch them on. Be prepared for the possibility that the user won't do so.
Of course nothing prevents you, having detected that you have been denied authorization, from putting up your own alert requesting that the user switch to Settings and authorize you.

If an iOS consumer denies permission to 'Use Current Location', is it technically possible to show the permission dialogue again?

My iOS app wants to display the users current location. Nothing special - but to do so, the first time the app is ran (or more to the point, the first time an MKViewMap in the app is displayed, I guess...) .. the user is asked for permission (which is awesome).
eg.
Now, if the user accidentally says DON'T ALLOW or decides to (later on) give permission ... is there technically a way we can reset their previous decision and when the app is restarted, ask them again automatically when the MKViewMap is next rendered again?
The user can enable or disable that option in the setting of the iphone. To do this, user have to select the Privacy option in the Setting Menu, and then select the Location Services option and than search the desired app to whom user want to enable or disable the permission and perform desired function by switching the toggle button on or off.
As it was a Private API provided from Apple the alert cannot be shown up again. Alternatively, we can check manually and show an alert like this.
The following can be read in the Apple docs:
"...it is recommended that you always call the locationServicesEnabled class method of CLLocationManager before attempting to start either the standard or significant-change location services. If it returns NO and you attempt to start location services anyway, the system prompts the user to confirm whether location services should be re-enabled. Given that location services are very likely to be disabled on purpose, the user might not welcome this prompt."
If I understand it right the alert will pop up everytime you try to get the users location, but it's not recommended to do so.
Link to full post:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW1
No you cannot do so. Rather than this, you can just check the latitude and longitude value and show alert to the user that enable the service from settings.

Resources