Languages

Menu
Sites
Language
GPS location in S3 Gear Watchapp Web implementation

Hi,

I'm going to be mad. ;) My implementation looks like:

navigator.geolocation.getCurrentPosition(
            function(position) {
                ...
            },
            function(error) {
                ...
            }, { // GPS configuration
                "enableHighAccuracy": false,
                "timeout": 5000 * 1000,
                "maximumAge": Infinity
            }
        );

whereas I tried a lot of GPS configuration variants having a short or long timeout, a concret maximumAge or enableHighAccuracy set to true. Also I set the privilege for getting the tizen location (sorry can't include it, because links in topics are forbitten) and in addition the location.gps feature in the config.xml file.

My S3 gear is flashed to the new Tizen 4.0 version rolled out last month. Be sure that GPS is enabled in the S3 Gear settings. The really great app "here" works fine/ without any problem and finds direct the correct location.

But my implementation always runs in the error function and reports first a POSITION_UNAVAILABLE and afterwards a TIMEOUT PositionError. Until now I didn't get any location testing inside or outside. :(

Reading the documentation

enableHighAccuracy    When enabled, use GPS only to improve the location accuracy. When disabled, use both GPS and WPS. Enabling it may result in slower response times or increased power consumption. Default: false
timeout    The maximum length of time (expressed in milliseconds) that is allowed to pass from the call to getCurrentPosition() until the corresponding successCallback is invoked. The maximum allowed value is 120. Default: 120
maximumAge    Sets to return a cached position whose age is no greater than the specified time in milliseconds. If maximumAge is set to 0, a new position object is acquired immediately. Default: 0

I'm a little bit surprised that the max allowed timeout is 120 millisecs? Maybe it's the delay for my first POSITION_UNAVAILABLE error? And after 5000*1000 millisecs I get the real timeout?

Please help! What is my mistake, what I'm doing wrong?

Best regards Holger

Edited by: Holger Dahm on 09 Apr, 2019

Responses

3 Replies
Alessio Arena

I am having a very similar issue.

I'm developing a Web application watch face requiring geolocation, and despite having all the required features and privileges like you pointed, background permissions as well just in case, nothing gets through.

I tested it on emulator (with location injected) and actual watch, tried the getCurrentPosition and watchPosition methods, copy and pasted every example I could find, tried any settings for the request I found, but nothing.

In my case the request always times out (error 3)

On the web simulator application everything works fine.

 

One thing I noticed is that on the emulator/watch the app never asks for permission to the user while in the browser it does every time.

I also tried to link the position request to some event like a user click just to make sure that wasn't because I was trying to run it at startup

 

Help would be very appreciated.

Alessio Arena

I finally managed to have this working.

There was nothing I was doing wrong in the end. This problem was linked to building a Tizen 5.0 app and as soon as a switched to 4.0 everything worked like a charm.

Not sure what caused that, but obviously there is something wrong with the development environment for Tizen 5.0.

Hope this helps someone else

Alessio Arena

I finally understood what was happening..

When I went back to Tizen 4.0, the project defaulted to building a 2.3.x version.

For that older version defining the privilege was enough, but not anymore.

In Tizen >4.0, you need to define the privileges AND explicitly request the user permission.

 

Some resources to get this working:

https://developer.tizen.org/development/guides/web-application/security/privacy-related-permissions

https://developer.tizen.org/development/training/web-application/understanding-tizen-programming/security-and-api-privileges

 

This was what pointed me to the right solution:

https://developers.google.com/web/updates/2015/04/permissions-api-for-the-web