here is my code.
Code: Select all
Global browserID
Global theURL
global tTitles
global thedata
on preopencard
# quit if we are not on a mobile device
if the environment is not "mobile" then exit preopencard
#current location
wait 1 seconds
put mobileCurrentLocation() into tLocation
put tLocation["latitude"] into fld "Dlat"
put tLocation["longitude"] into fld "Dlong"
put fld"Dlat"& comma & fld"Dlong" into lat1
put lat1 into lat_lng
delete variable lat1
if fld "lat" is empty then
answer error "No Gps Data"
end if
#Store Location
put fld"lat"& comma & fld"long" into Store1
put store1 into Store_lng
delete variable store1
if store_lng is empty then
Answer "This mobile is NOT able to track GPS location"
end if
put specialFolderPath("documents") & "/navi2.html" into documentFilePath
if there is not a file documentFilePath then
put specialFolderPath("engine") & "/navi2.html" into engineFilePath
put URL ("binfile:" & engineFilePath) into URL ("binfile:" & documentFilePath)
end if
put specialFolderPath("documents") & "/navi2.html" into thehtmlFile
put URL("file:" & thehtmlFile) into theData
put "var origin1 = new google.maps.LatLng(" & lat_lng & ");" into line 30 of theData
put "var destinationA = new google.maps.LatLng(" & Store_lng & ");" into line 31 of theData
put "zoom:17," into line 37 of theData
put theData into URL ("file:" & thehtmlFile)
put "file://" & specialFolderPath("documents") & "/navi2.html" into theURL
replace space with "%20" in theURL
answer theurl
end preOpenCard