5 Replies Latest reply on Sep 7, 2017 11:34 PM by José Jesús Pérez Rivas

    location timeout android 7

    rwanitorr47209182 Level 1

      Hi,

      Since 1 week, my location doen't work anymore with cordova with the last version and only with my phone !

      My version of my ROM is RR/Android 7.1.

      I've tested with my app and "Cordova showcase", both can't get my current location and I get "Error 3, timeout expired".

      But, i've tested on an other phone which is with Android 6, MIUI version and it works...

       

      Cordova can work on Android 7/25 ?

      Help me, because I can't continue my dev...

      Thnaks !!!

        • 1. Re: location timeout android 7
          José Jesús Pérez Rivas Adobe Community Professional (Moderator)

          Hi

           

          You might not include the "enableHighAccuracy" parameter in your geolocation function. This parameter helps you capture your position through your connection.

           

          For example:

           

              function onSuccess(position) {

                  var element = document.getElementById('geolocation');

                  element.innerHTML = 'Latitude: '  + position.coords.latitude      + '<br />' +

                                      'Longitude: ' + position.coords.longitude     + '<br />' +

                                      '<hr />'      + element.innerHTML;

              }

              function onError(error) {

                  alert('code: '    + error.code    + '\n' +

                        'message: ' + error.message + '\n');

              }

              var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true });

           

          Regards!

          • 2. Re: location timeout android 7
            rwanitorr47209182 Level 1

            Hi !

            Thanks for your reply !

            Here my code :

            Edit fiddle - JSFiddle

            And, it doesn't work for watchPosition and GetCurrentLocation

             

            Today, a friend who beta test my app told me there is an issue with the app. Exactly the same issue that me !

            But, he has Android 6...

            The issue not comes only with my app but "Cordova Showcase" is also affected ..

            Always : Timeout, Er 3

            Do you know a cordova app which use location ?

             

            What permissions I need to allow location ? Is there some plugins to allow location ?

             

            Pffiou ! It Isn't easy when all well worked

             

            Thanks

            • 3. Re: location timeout android 7
              José Jesús Pérez Rivas Adobe Community Professional (Moderator)

              Hi,

               

              You can use the function you mentioned, the two should work correctly.

               

              As an example app, you can install this "https://play.google.com/store/apps/details?id=com.purorural.purorural". This application will ask for GPS permissions. Please confirm if it works for you, it's an app made with phonegap.

               

              You do not have to add additional permissions to those that Cordova adds by default.

               

              Regards

              • 4. Re: location timeout android 7
                rwanitorr47209182 Level 1

                Hi! It doesn't work anymore :'(... puro rural also doesn't work.. My code is clean... my code is clean, do you have an idea ??? I can send you my app ? Thanks !

                • 5. Re: location timeout android 7
                  José Jesús Pérez Rivas Adobe Community Professional (Moderator)

                  Hi!,

                   

                  Can you access the view that I send you in this response from Pure Rural where the blue circle is your position?

                   

                  Yes, you can send me your project, you can upload it to Bitbucket or Github and share the public url so that I can review it.

                   

                  Regards!

                   

                  IMG_9617.PNG