本文整理汇总了TypeScript中ionic-native.Geolocation类的典型用法代码示例。如果您正苦于以下问题:TypeScript Geolocation类的具体用法?TypeScript Geolocation怎么用?TypeScript Geolocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Geolocation类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: startTracking
startTracking() {
console.log(":startTracking: ", BackgroundGeolocation);
let options = {
frequency: 3000,
enableHighAccuracy: true
};
this.watch = Geolocation.watchPosition(options);
this.watch.subscribe((data) => {
alert("latitude: "+data.coords.latitude);
alert("longitude: "+data.coords.longitude);
console.log("latitude: "+data.coords.latitude);
console.log("longitude: "+data.coords.longitude);
this.notifyLocation(data.coords);
});
let backgroundOptions = {
desiredAccuracy: 10,
stationaryRadius: 10,
distanceFilter: 30
};
this.backGeolocation.configure((location) => {
this.notifyLocation(location);
}, (err) => {
console.log(err);
}, backgroundOptions);
this.backGeolocation.start();
return this.position;
}
开发者ID:lucascardoso,项目名称:app-test-plugins-ionic2,代码行数:33,代码来源:location-tracker.ts
示例2: getGeo
getGeo() {
Geolocation.getCurrentPosition().then(resp=> {
this.latitude = resp.coords.latitude;
this.longitude = resp.coords.longitude;
this.altitude = resp.coords.altitude
})
}
开发者ID:ralphowino,项目名称:ionic-native-kitchen-sink,代码行数:7,代码来源:geolocation.ts
示例3: acquireLocation
private acquireLocation() {
Geolocation.getCurrentPosition().then((resp) => {
console.log('Coordinates are ' + resp.coords.latitude + ',' + resp.coords.longitude);
this.submission.latitude = resp.coords.latitude;
this.submission.longitude = resp.coords.longitude;
});
}
开发者ID:codeforcologne,项目名称:sagsunskoeln-app,代码行数:7,代码来源:submission-builder.ts
示例4: constructor
constructor(private nav: NavController) {
Geolocation.getCurrentPosition().then((resp) => {
console.log(resp.coords);
//resp.coords.longitude
})
}
开发者ID:colanconnon,项目名称:ionicFishTracker2,代码行数:7,代码来源:newfishcatch.ts
示例5: GoogleMapsLatLng
this.map.on(GoogleMapsEvent.MAP_READY).subscribe(() => {
console.log('Map is ready!');
console.log(this.lat + ' ' + this.long);
Geolocation.getCurrentPosition().then(pos => {
console.log('lat: ' + pos.coords.latitude + ', lon: ' + pos.coords.longitude);
this.lat = pos.coords.latitude;
this.long = pos.coords.longitude;
let coord = new GoogleMapsLatLng(this.lat, this.long);
this.map.setCenter(coord);
//this.map.animateCamera({
// 'target': coord,
// 'tilt': 60,
// 'zoom': 18,
// 'bearing': 140
//});
this.map.addMarker({
'position':coord,
'title': "The TagOn Project HeadQuarters"}).then(marker => {
marker.addEventListener(GoogleMapsEvent.INFO_CLICK).subscribe(() => {
console.log("Info window was clicked");
});
});
});
});
开发者ID:kolexinfos,项目名称:tag,代码行数:30,代码来源:home.ts
示例6: loadMap
loadMap(){
Geolocation.getCurrentPosition().then( (position) => {
console.log(position.coords.latitude+' '+position.coords.longitude);
let cur_location = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
let myStyles=[{
featureType: "poi",
elementType: "labels",
stylers: [{ visibility: "off" }]
}];
let mapOptions = {
center: cur_location,
zoom: 18,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: myStyles
}
this.map = new google.maps.Map(document.getElementById("map"), mapOptions);
this.marker = new google.maps.Marker({
map: this.map,
draggable: true,
position: cur_location
});
this.map.addListener('click', (event) => {
this.moveMarker(event.latLng);
});
});
}
开发者ID:justin1225,项目名称:diner,代码行数:33,代码来源:diner.ts
示例7: setLocation
setLocation(): void {
Geolocation.getCurrentPosition().then((position) => {
this.latitude = position.coords.latitude;
this.longitude = position.coords.longitude;
this.maps.changeMarker(position.coords.latitude, position.coords.longitude);
let data = {
latitude: this.latitude,
longitude: this.longitude
};
this.dataService.setLocation(data);
let alert = this.alertCtrl.create({
title: 'Location set!',
subTitle: 'You can now find your way back to your camp site from anywhere by clicking the button in the top right corner.',
buttons: [{text: 'Ok'}]
});
alert.present();
});
}
开发者ID:Arthurisme,项目名称:Ionic2Expert,代码行数:27,代码来源:location.ts
示例8: startWatch
startWatch() {
this.subscription = Geolocation.watchPosition(this.options).subscribe(position => {
this.record=true;
console.log(position);
this.geo = position;
});
}
开发者ID:thgautier92,项目名称:ionicV2,代码行数:7,代码来源:geolocation.ts
示例9: findMe
findMe(event) {
Geolocation.getCurrentPosition().then((response) => {
this.lat = response.coords.latitude;
this.long = response.coords.longitude;
this.altitude = response.coords.altitude;
}, (error) => {
console.log("Error: ", error);
});
}
开发者ID:webdeziner,项目名称:geolocationApp,代码行数:9,代码来源:home.ts
示例10: getPosition
getPosition(){
console.log("click");
Geolocation.getCurrentPosition()
.then(rta =>{
console.log(rta);
})
.catch(error=>{
console.log(error);
})
}
开发者ID:EscuelaIt,项目名称:class8-ionic-2,代码行数:10,代码来源:home.ts
注:本文中的ionic-native.Geolocation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论