The following table describes the possible error codes returned in the PositionError object:
Code | Constant | Description |
---|---|---|
0 | UNKNOWN_ERROR | The method failed to retrieve the location of the device due to an unknown error. |
1 | PERMISSION_DENIED | The method failed to retrieve the location of the device because the application does not have permission to use the Location Service. |
2 | POSITION_UNAVAILABLE | The location of the device could not be determined. |
3 | TIMEOUT | The method was unable to retrieve the location information within the specified maximum timeout interval. |
Following is a sample code, which makes use of the PositionError object. Here errorHandler method is a callback method:
function errorHandler( err ) { if (err.code == 1) { // access is denied } ... }