Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-14032

Timeout active/starts before user answers location permissions prompt - iOS

    XMLWordPrintableJSON

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 =

      { 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            AaronM92 Aaron Mulcahy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: