Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Journey Recording using GPS Tracking

Hello! Working on it, but there are no news yet..

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Journey Recording using GPS Tracking

Joe, you didn't change code as we suggested a few times above. You have to replace prepoints.push([(coordsArray{i}.time - startTime) / 1000 / 60, coordsArray.alt]);/pre with prepoints.push([(coordsArray.time - startTime) / 1000 / 60, coordsArray.alt]);/pre
Just to remind that custom JS code is outside the scope of our support. You must debug your custom code http://docs.appery.io/documentation/d...

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

Thanks Maryna! I've changed it. When I test the app in Google Chrome using Developer Tools, I get this in Console when I click "initialize" and the second is from clicking "view results." I'm assuming the value is null since there aren't any points being stored for it to render. Any thoughts?

Image

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Journey Recording using GPS Tracking

Hello! Google Chrome doesn't have GPS - it returns ones current position and after that doesn't refresh coordinates. That's why coordinates array is empty.

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

That's what I assumed, but I'm not sure how else to debug the app without Chrome. What's the next step? Look for errors in logcat in Eclipse? Or check for errors in jslint/jshint? Thanks Maryna!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Journey Recording using GPS Tracking

Hi Joe,

1) jslint/jshint - doesn't display errors
2) Look for errors in logcat - is a possible option
3) You can test dummy data where it's possible. For example, on 'result' page read data not from localStorage variable, but paste a row with data in needed format. You can replace the following page codevar coordsArray = JSON.parse(localStorage.getItem("coordsArray"));/codewith:codevar coordsArray = JSON.parse('......');/code
where replace '......' with data in format you need them in localStorage.

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

Good news! The average speed graph on the results page displays the data, and the second graph for altitude displays nothing. This is progress! If I recall, we never set up the local storage variable for the altitude data to be displayed or stored. So would that be something like adding this to geolocation success? code
Appery("altitude").text("Altitude: ft");/code
after code else {
Appery("avrSpeedLabel").text("Average speed: 0 m/h");
} /code

Do I need to change or add to any of the geolocation service mapping displayed below? Image
It's been a long time since we've set up the localStorage for the "Coordsarray" variable, what needs to happen for the "altitude" label on the "recordride" page, and for "plot2" to populate on the "results" page?

Thank you so very much for your help. I believe this project will be mostly finished after this major milestone!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Journey Recording using GPS Tracking

Hello! Please take a look at this reply https://getsatisfaction.com/apperyio/...

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

Does that mean to removecodeAppery("altitude").text("Altitude: ft");/code?
My geolocation success event has the following code:codeAppery("errorLabel").hide();
invokeTimes++;
Appery("dataLabel")&#46;html('Latitude: ' + data&#46;coords&#46;latitude + '<br>' +
'Longitude: ' + data&#46;coords&#46;longitude + '<br>' +
'Altitude: ' + data&#46;coords&#46;altitude + '<br>' +
'Accuracy: ' + data&#46;coords&#46;accuracy + '<br>' +
'Timestamp: ' + data&#46;timestamp + '<br>');
if(!paused) {
if(oldTime != 0) {
var dist = findDistance(oldLat, oldLng, data&#46;coords&#46;latitude, data&#46;coords&#46;longitude);
totalDist += dist;
totalTime += data&#46;timestamp - oldTime;
}
oldTime = data&#46;timestamp;
oldLat = data&#46;coords&#46;latitude;
oldLng = data&#46;coords&#46;longitude;
Appery("totalDistLabel")&#46;text("Distance: " + round(totalDist) + 'm');
Appery("totalTimeLabel")&#46;text("Time: " + mSecToTime(totalTime));
if (totalTime>0) {
Appery("avrSpeedLabel")&#46;text("Average speed: " + round(totalDist&#47;(totalTime&#47;(1000*3600))) + " m&#47;h");
} else {
Appery("avrSpeedLabel")&#46;text("Average speed: 0 m&#47;h");
}

var coordsArray = [];
try {
coordsArray = JSON&#46;parse(localStorage&#46;getItem("coordsArray"));
if ({}&#46;toString&#46;call(coordsArray) !== "[object Array]") {
coordsArray = [];
}
}catch ( e ){
coordsArray = [];
}
var speed = totalTime!=0 ? round(totalDist&#47;(totalTime&#47;(1000*3600))) : 0;
var timeStamp = new Date(data&#46;timestamp)&#46;getTime();
coordsArray&#46;push({'time': timeStamp, 'lat': data&#46;coords&#46;latitude, 'lng': data&#46;coords&#46;longitude, 'speed': speed});
localStorage&#46;setItem("coordsArray", JSON&#46;stringify(coordsArray));
}
updateMarker(data&#46;coords&#46;latitude, data&#46;coords&#46;longitude);
coordsArray&#46;push({'time': timeStamp, 'lat': data&#46;coords&#46;latitude, 'lng': data&#46;coords&#46;longitude, 'alt': data&#46;coords&#46;altitude, 'speed': speed});/code And I think I'm getting this in logcat: Image
That's about where I click "view ride data." When I click, nothing happens. I don't navigate to "results" page. Did I add something incorrectly?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Journey Recording using GPS Tracking

Hello! Sorry for delay. We're working on it.

Return to “Issues”