语言

Menu
Sites
Language
Get Location using wifi or mobile network

Currently i am creating an application for the samsung gear s smartwatch. My widget/app needs to get Location data everywhere (it's a safety application). The basic GPS location works fine as you can see in my code below. The problem is that GPS only works outside, since my app is a safety app i need to get Location data everywhere. On phones you are able to use Wifi and mobile network to get a location. My question is is it possible to get a location using wifi or mobile network on a smartwatch? and if it's possible how?
   
   

 function getBestGPSLocation(){  
        //GPS
        navigator.geolocation.getCurrentPosition(success, error, {maximumAge:60000, timeout:5000});
        //Wifi
        // I want wifi location here
        //Mobile Network
    }   
    function error(error) {
    // just some error codes they work either
    switch(error.code) {
        case error.PERMISSION_DENIED:
            console.log("permission denied");
            break;
        case error.POSITION_UNAVAILABLE:
              console.log("your position is unavailable");
            break;
        case error.TIMEOUT:
            console.log("a timeout occured");
            break;
        case error.UNKNOWN_ERROR:
            console.log("an unknow error occured");
            break;
        }
    }

    function success(position) {
    // this works i get all the data
       alert(position);
    }

 

编辑者为: Siebert Elhorst 20 3月, 2015

响应

7 回复
AVSukhov

Hello,

I think it`s impossible.

If you open Settings -> Connection on Gear S device you can see that Location supports GPS only.

Siebert Elhorst

My question was not formulated that well (although i think you understood what i meant). I meant if it is possible to get a location using wifi or mobile network, which is possible on mobile phone. I think it should be possible since you have wifi and mobile network connection but after searching a lot on the internet it looks like it is impossible.

Marco Buettner

As I know you cannot setup the GPS either than on/off.

Siebert Elhorst

As for now i use GPS location which works great. But the problem is that i can't use GPS inside a building, though with wifi location it is possible to get a location inside a building. For mobile phones you are able to use wifi location so why would it not be possible for the smartwatch. You think it's impossible to use wifi location for the smartwatch?

pradeep ramaiah

Hi,

I dont think it is possible to switch smartwatch with wifi connection.

Łukasz Grabiec

First read following documentation:

http://dev.w3.org/geo/api/spec-source.html

According to this, HTML5 location should work as fused location service:

Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs, as well as user input.

 

Morover in Gear S instruction it is said that AGPS, GPS and GLONASS are supported.

AGPS means that if you have SIM card inserted, some network operator servers should help to esablish your postion.

My experience is following:

Non of these features works in Gear S. I tried SIM cards from two operators and AGPS don't work.

Taking location from WiFi network or just IP does not work at all.

Morover when I try to use GPS in closed locations and device tries to find a fix - in minute or two devices becomes hot and overheat popup warning is shown.

Next internet is closed down without any warning.

From developer point of view this is nightmare.

From my experience location works only outside but power consumtion increase dramatically!

 

Siebert Elhorst

Since i made the post i still haven't got any further, for now i just think it's impossible to get location data using wifi or mobile network.

I currently have these 2 options:

- Use GPS location only
- Get Location data by Phone and communicate this with the Tizen wearable using SAP communication.

Both have their disadvantages, GPS doesn't work inside and location by phone removes the whole point of a standalone device.

Furthermore i have one question, how much power does your gear s consume with GPS location? I tried mine while running 4 hours and requesting GPS location every 10 seconds. It consumed 25% of my battery (around 6% per hour). My app is for employees, so their average working day is around 7-10 hours, which is around 50-80% battery.