You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Aaron Mulcahy (JIRA)" <ji...@apache.org> on 2018/04/13 08:27:00 UTC

[jira] [Created] (CB-14032) Timeout active/starts before user answers location permissions prompt - iOS

Aaron Mulcahy created CB-14032:
----------------------------------

             Summary: Timeout active/starts before user answers location permissions prompt - iOS
                 Key: CB-14032
                 URL: https://issues.apache.org/jira/browse/CB-14032
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-geolocation
            Reporter: Aaron Mulcahy


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 = {
     enableHighAccuracy: true,
     timeout: 5000,
     maximumAge: 1000
   };
  //Desired functionality - This is not executed until the user has answered 
  permissions prompt
  navigator.geolocation.getCurrentPosition(success,
    function (positionError) {
      console.log('Access Denied');
      }, 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org