vendredi 9 août 2019

(Tizen Web App) Getting the Geo Location doesn't resolve error or success in emulator

Trying to get the geo location for a Tizen Wearable Web Application Emulator.

My flow is:

  1. Check permission

  2. Ask permission if no permission

  3. If I have permission request the geo location

  4. Otherwise die and return error

I've resorted in the example to just outputting to the console.

I've tried requesting the permission, passing a method which just outputs to console.

The code provided is after the Passover from permission with the permission successful.

Permission: http://tizen.org/privilege/location

GeoLocation.prototype.getlastgeolocation2 = function (f_obj)
{
    console.log("HERE");
    if (navigator.geolocation)
    {
        if(!f_obj.maxAge || f_obj.maxAge == null || f_obj.maxAge == 0)
        {
            console.log(1);
            navigator.geolocation.getCurrentPosition(function(position){ console.log("Success");}, function(error){ console.log("Error");},{maximumAge: 60000});
        }
        else
        {
            console.log(2);
            navigator.geolocation.getCurrentPosition(function(position){ console.log("Success");}, function(error){ console.log("Error");},{maximumAge: f_obj.maxAge});
        }
    }
    else
    {
        console.log("No Navigator");
        returnMethod(false,'Geolocation is not supported.');
    }
};

I should get in the console: HERE, 1, Success or Error

I get: HERE, 1

Suggesting the navigator doesn't resolve. No errors in the console nothing.




Aucun commentaire:

Enregistrer un commentaire