Created
October 3, 2014 21:55
-
-
Save addieljuarez/2c9ce5241d9240d764a6 to your computer and use it in GitHub Desktop.
mapaiOS8'js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.index.open(); | |
| var MapModule = require('ti.map'); | |
| Ti.Geolocation.addEventListener('authorization', function(e) { | |
| Ti.API.info('authorization event:' + JSON.stringify(e)); | |
| }); | |
| Ti.Geolocation.getCurrentPosition(function(e) { | |
| // if (!e.success || e.error) { | |
| // Ti.API.info("Code translation: " + translateErrorCode(e.code)); | |
| // alert('error ' + JSON.stringify(e.error)); | |
| // return; | |
| // } | |
| var longitude = e.coords.longitude; | |
| var latitude = e.coords.latitude; | |
| var altitude = e.coords.altitude; | |
| var heading = e.coords.heading; | |
| var accuracy = e.coords.accuracy; | |
| var speed = e.coords.speed; | |
| var timestamp = e.coords.timestamp; | |
| var altitudeAccuracy = e.coords.altitudeAccuracy; | |
| Ti.API.info('speed ' + speed); | |
| var annotation = MapModule.createAnnotation({ | |
| latitude:latitude, | |
| longitude:longitude, | |
| animation:true, | |
| title:'test', | |
| subtitle:'test2', | |
| pincolor:MapModule.ANNOTATION_RED, | |
| }); | |
| var mapview = MapModule.createView({ | |
| mapType : MapModule.NORMAL_TYPE, | |
| animate : true, | |
| regionFit : true, | |
| userLocation : true, | |
| width : '100%', | |
| zIndex : 2, | |
| height:'100%', | |
| // height : 180, | |
| // top : 400, | |
| left : '0%', | |
| annotations:[annotation], | |
| region:{ | |
| latitude:latitude, | |
| longitude:longitude, | |
| latitudeDelta:0.05, | |
| longitudeDelta:0.05, | |
| } | |
| }); | |
| Titanium.API.info('geo - current location: ' + new Date(timestamp) + ' long ' + longitude + ' lat ' + latitude + ' accuracy ' + accuracy); | |
| $.index.add(mapview); | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment