How to remove ios geolocation auth request message on cordova
You need to install cordova-plugin-geolocation (cordova plugin add cordova-plugin-geolocation) then set your preferences in your config.xml, for iOS, such as
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>need to access your location for reasons</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysAndWhenInUseUsageDescription">
<string>need to access your location for reasons</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysUsageDescription">
<string>need to access your location for reasons</string>
</edit-config>
Of course edit
need to access your location for reasons
Cordova iOS location message
The solution has changed for cordova-plugin-geolocation: "4.0.0". This is what you need to add in your config.xml
:
<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
<string>need location access to find things nearby</string>
</edit-config>
For more information: https://github.com/apache/cordova-plugin-geolocation
Location permission alert on iPhone with Cordova
Same as the "edit" in the original question, I had to remove the old version of the geolocation plugin and add the new one. Then I had to remove/add the Cordova iOS platform. Only then could I add NSLocationWhenInUseUsageDescription
to the .plist file as DaveAlden mentions in his answer with success.
First, remove/add the geolocation plugin:
cordova plugin rm org.apache.cordova.geolocation
cordova plugin add org.apache.cordova.geolocation
Second, remove/add the iOS platform:
cordova platform rm ios
cordova platform add ios
Last, add NSLocationWhenInUseUsageDescription
to the .plist. Open /platforms/ios/{project}/{project}-Info.plist
and add the following:
<key>NSLocationWhenInUseUsageDescription</key>
<string>[App Name] would like to access your location when running and displayed.</string>
See this iOS Developer Library link for detailed information regarding NSLocationWhenInUseUsageDescription
versus NSLocationAlwaysUsageDescription
versus NSLocationUsageDescription
.
Has anyone faced Geolocation permission alert for iOS showing twice issue along with bundle location?
I finally solved this with on device ready function loading to body tag
function onDeviceReady(){
return navigator.geolocation.getCurrentPosition(initialize);
document.addEventListener("backbutton", onBackKeyDown, false);
}
function onLoad()
{
if (typeof navigator.device == "undefined"){
document.addEventListener("deviceready", onDeviceReady, false);
} else {
onDeviceReady();
}
}
<body onload="onLoad();">
Related Topics
How Long Does Apple Permit a Background Task to Run
Detect App Launch from Widgetkit Widget Extension
Prevent Dispatch_After() Background Task from Being Executed
How to Disable 4 Finger Gestures on iPad
Responding to Ram Availability in iOS
Objective-C Wrapper for Cfunctionpointer to a Swift Closure
Nsgenericexception Reason Collection <Nsconcretemaptable: Xxx>
Uiimagejpegrepresentation Received Memory Warning
Get User Profile Details (Especially Email Address) from Twitter in iOS
iOS Facebook Sdk - Post Open Graph and Show on Timeline Without Clicking Activity Log
What Is the Swift Equivalent of Makeobjectsperformselector
Setting Image for Uibarbuttonitem - Image Stretched
iOS 10, Nsuserdefaults Does Not Work
Can Somebody Give a Snippet of "Append If Not Exists" Method in Swift Array
No Suitable Records Were Found Verify Your Bundle Identifier Is Correct