I am getting error while using start Location Monitor,The error is observed in Android 5. I am getting the following error:jsonObject["coords"] not found.
i found the solution . . . update adf mobile framework or using javascript code to get Location as the following: in backing bean call the Javascript method using :
AdfmfContainerUtilities.invokeContainerJavaScriptFunction(AdfmfJavaUtilities.getFeatureName(),"getLocation", new Object[] { });
And in maf-feature.xml include Javascript file having content as mentioned :
function getLocation() {
if (navigator.geolocation) {
var timeoutVal = 10 * 1000 * 1000;
navigator.geolocation.getCurrentPosition(showPosition, displayError,
{ enableHighAccuracy: true, timeout: timeoutVal, maximumAge: 0 });
}
else {
alert("error in finding location");
}
}
function showPosition(position) {
alert( position.coords.longitude+" "+ position.coords.latitude);
adf.mf.el.setValue( {
"name" : "#{pageFlowScope.longitude}", "value" : position.coords.longitude
},
onSuccess, onFail);
adf.mf.el.setValue( {
"name" : "#{pageFlowScope.latitude}", "value" : position.coords.latitude
},
onSuccess, onFail);
}
function onSuccess(request, response) {
alert(response);
}
function onFail(request, response) {
alert(response);
}
function displayError(error) {
var errors = {
1: 'Permission denied',
2: 'Position unavailable',
3: 'Request timeout'
};
alert("Error: " + errors[error.code]);
}