I'll update when have an exact answer. Working on it.
I'll update when have an exact answer. Working on it.
Hello!
1) "Init" button supposed to start the GPS service on the phone -- as you set enableHighAccuracy=true in service settings you'll get coordinates from satellite, but it takes time to connect to satellite (up to few minutes). That's why first answers you'll get with WIFI and the cellular network. After the connection to satellite finished you'll get answers from satellite.
2) Nothing is happening with the labels - click Start button, after you'll get new data from satellite labels values will change (you should test it on device).
3) customize that marker - this should help https://developers.google.com/maps/tu...
4) to save the whole data you would need to save coordinates into localStorage (on service success add the following JS)
codevar coordsArray;
try {
coordsArray = JSON.parse(localStorage.getItem("coordsArray"));
if ({}.toString.call(coordsArray) !== "[object Array]") {
coordsArray = [];
}
}catch ( e ){
}
coordsArray.push({'time': data.timestamp, 'lat': data.coords.latitude, 'lng': data.coords.longitude})
localStorage.setItem("coordsArray", JSON.stringify(coordsArray));/code
all coordinates will be saved in coordsArray variable
So I would simply add this Javascript code in javascript1:
code
var iconBase = 'https://maps.google.com/mapfiles/kml/shapes/';
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: iconBase + 'schools_maps.png',
shadow: iconBase + 'schools_maps.shadow.png'
});/code
and replace the url with my icon url? do I nee to change the 'schools_maps.png or the schools_maps.shadow.png values to something else?
Also, I added the service success code to the events tab on event success.
I tested the app on my device, and no values populate in the label components when I click "Init", with GPS service turn on with my android device, then click "start". What's going on?
Thanks!
Hi Joe,
Sorry, no updates yet. I'll let you know when have more information.
Hi,
to use custom marker you would need to set an image for marker. You can set any image (from any site) with appropriate size.
Yes, you should add your code to JavaScript1 (you would need to change updateMarker function). For example:
codeupdateMarker
например так
function updateMarker (lat, lng){
if (!map) {
map = Tiggzi("map").gmap;
}
var newPoint = new google.maps.LatLng(lat, lng);
if (marker) {
// Marker already created - Move it
marker.setPosition(newPoint);
} else {
// Marker does not exist - Create it
var iconBase = 'https://maps.google.com/mapfiles/kml/shapes/';
marker = new google.maps.Marker({
position: newPoint,
map: map,
icon: iconBase + 'schools_maps.png',
shadow: iconBase + 'schools_maps.shadow.png'
});
}
// Center the map on the new position
map.setCenter(newPoint);
}/code
"no values populate in the label components" - you have GPS service and tracking turned on, but as we mentioned above "Besides using watchPosition function successCallback invokes only if new position differs significantly from the previous position - because of this if you drive slowly and when standing still - successCallback function is invoked rarely (once per minute or less), and update is rare."
What's going on? -- To test this functionality you should walk.
Basically all this functionality should be coded by you. Sorry, but we can't build such a big part of app instead of you, it's outside the scope of our support. Hope you understand...
Thanks Marina! The whole support teams help has been unprecedented, and it's clear that I've accomplished a lot with your help.
I'm sorry about my previous oversight regarding the labels. I suppose I just assumed some value would populate before I moved anywhere, and I didn't realize that it was necessary to move a significant distance before anything would happen.
So I did in fact move, and something did populate in the first two label components, and the marker on the map component would update. I also successfully changed the icon on the "record ride test" app.
I only get values in the top two label components. Distance traveled in km and time elapsed. Should there be more values populating in the other label components?
I also tried to change the icon in my "Pedal Collective Mobile" app the same way, by adding the below code to my "javascript1" but it didn't work. Why might this be?code
function updateMarker (lat, lng){
if (!map) {
map = Tiggzi("directionsMap").gmap;
}
var newPoint = new google.maps.LatLng(lat, lng);
if (marker) {
// Marker already created - Move it
marker.setPosition(newPoint);
} else {
// Marker does not exist - Create it
var iconBase = 'http://api.ning.com:80/files/46rp3lFVpjX0fzcrY-NVLuL6XoLKtiY7xkVy68mqyJz1ZUGld8K2K8MSoS08itoXa7YxefQyfC*wID2trqrKmizxSa554n5i/lunapic_136735513740094_6.gif';
marker = new google.maps.Marker({
position: newPoint,
map: map,
icon: iconBase + 'schools_maps.png',
shadow: iconBase + 'schools_maps.shadow.png'
});
}
// Center the map on the new position
map.setCenter(newPoint);
}/code
And now, something has happened where the "directionsMap" component doesn't show the route, but thankfully the turn-by-turn directions still render in the below panel.
As always, thank you very much.
Update: I have gone ahead and added the "record ride" page to the "pedal collective" mobile app, trying to follow the above instructions as best I can.
So now the text directions render on the "map" page still, but nothing at all happens in the "directionsMap" component.
And the "recordride" page doesn't really work, as far as I can tell when I test it on my device. Where have I gone wrong? Is there some conflict in the script? This error looks familiar:
I'm not really sure what might need to be changed.
Thanks for taking a look!
Hi Joe,
We will test this and update.
Thanks Katya!
Any luck yet?