Ibm mobilefirst IBM MobileFirst--获取位置
我有MobileFirst(V7.O)应用程序。如何获取设备的当前纬度/经度。基本上,我在我的应用程序中的不同点记录一些信息,用户可以移动。。因此,在各种情况下,我希望得到当前的lat/log 你能提供一些提示以及如何获得这些信息吗Ibm mobilefirst IBM MobileFirst--获取位置,ibm-mobilefirst,Ibm Mobilefirst,我有MobileFirst(V7.O)应用程序。如何获取设备的当前纬度/经度。基本上,我在我的应用程序中的不同点记录一些信息,用户可以移动。。因此,在各种情况下,我希望得到当前的lat/log 你能提供一些提示以及如何获得这些信息吗 感谢您的帮助Cordova已捆绑在您的MobileFirst项目中。因此,您可以使用Cordova API来实现这一点 请参阅以下内容(向下滚动至API用法): // onSuccess Callback // This method accepts a Posit
感谢您的帮助Cordova已捆绑在您的MobileFirst项目中。因此,您可以使用Cordova API来实现这一点 请参阅以下内容(向下滚动至API用法):
// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
//
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError);