Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Is it possible to set a separate timeout for the permissions prompt/question to the timeout that is used for the navigator.geolocation.getCurrentPosition call within the cordova geolocation plugin?
If the user ignores this prompt or leaves the screen idle in iOS the function returns the error callback(as below times out after 5 seconds).
Ideal scenario.
- Timeout for user to answer permissions question - infinite. User needs to answer this before continuing.
- Timeout for getCurrentPosition - 1 second or even less to maintain a good user experience.
Basic example below.
if (navigator.geolocation) {
var options =
;
//Desired functionality - This is not executed until the user has answered
permissions prompt
navigator.geolocation.getCurrentPosition(success,
function (positionError)
, options);
function success(position)
{ console.log('User has allowed access to Location'); }}
Geolocation pluggin used to get the users position on certain calls with my app. The first time the user downloads the app and executes this call they are prompted with "Allow app to access your location while you are using the app?" - expected functionality.
If the user ignores this or leaves the screen idle in iOS the function returns the error callback(as below times out after 5 seconds). This is not an issue in Android as it appears to wait until the user has answered the permissions question before executing the navigator.geolocation.getCurrentPosition function. But in iOS(and chrome browser) the call times out without user input and enters positionError block.
The problem with having the same timeout is that if there is some issue obtaining users position, poor signal, etc. I don't want the app to hang for 5 seconds before returning a result.