How do you use javascript in apps?
I need a native Sailfish app to report my position to a server. I have done this as a web page through a browser but as soon as the screen goes black the reporting stops.
To my understanding you can use javascript in QML in apps. How do you do that? All I've seen yet is c++. How do i insert the following in QML?
navigator.geolocation.watchPosition(reportPosition);
function reportPosition(position) {
var url = "http://www.exemple.com/reportserver.cgi";
var positionAsString = "lon=" + position.coords.longitude +
"&lat=" + position.coords.latitude;
var request = new XMLHttpRequest();
request.open("POST", url);
request.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
request.send(msg);
}