Stop processing if locationservices==false
Is there a way for this? My app is pretty useless without it, so if they dont have it enabled, I have an alertDialog that tells them it needs to be enabled.
if(Titanium.Geolocation.locationServicesEnabled==false)
{
var locationDialog = Titanium.UI.createAlertDialog({
title: 'Error',
message: 'Location Services needs to be enabled for this application',
buttonNames: ['OK']
});
locationDialog.show();
}
Can I have the button I generate in the alert dialog to open the Location Services in the settings dialog, and stop processing the rest of the app?
1 Answer
-
Allegedly there is no approved way of launching the settings screen from an alert.
The closest you can get is to edit your tiapp.xml and set the persistent-wifi key to true, clean the iPhone build folder by deleting the contents of the folder and rebuilding your app. Doing this will force a setting called UIRequiresPersistentWiFi in your applications Info.plist and it will make iOS complain if the app is in airplane mode and will give you a button that lets you change the settings.
No this isn't necessarily a great or real fix, just some info about the one way to invoke settings.