Skip to content

GPSLocation not defined #7

@mridah

Description

@mridah

I installed the plugin using sudo cordova plugin add cordova-plugin-gpslocation and tried using it like :

var options = {
  enableHighAccuracy: true,
  maximumAge: 45000,
  timeout: 15000
}
var data = {};
var watchID = GPSLocation.getCurrentPosition(onSuccess, onError, options);

function onSuccess(position) {
    data['lat'] = position.coords.latitude;
    data['long'] = position.coords.longitude;
    data['error'] = 0;
    data['error_desc'] = null;
    alert(JSON.stringify(data))
 };

 function onError(error) {
    data['lat'] = null;
    data['long'] = null;
    data['error'] = 1;
    data['error_desc'] = error.code + ' : ' + error.message;
    alert(JSON.stringify(data))
 };

But it's giving me this error in the console :

Uncaught ReferenceError: GPSLocation is not defined(…)

Can you help me solve this problem @louisbl ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions