我很感激,如果有人能帮助我解决这个问题。该应用程序的结果是显示应用程序在设备上运行时的纬度和长度。
这是我的index.html:
date {
match => [ "mytimestamp" , "yyyy-MM-dd HH:mm:ssZ" ] # <= Z must be added
}
这是app.js:
<!DOCTYPE html>
<html>
<head>
<ti
tle>Geo Location</title>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' https://maps.googleapis.com/ https://maps.gstatic.com/ https://mts0.googleapis.com/ 'unsafe-inline' 'unsafe-eval'">
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="cordova.js"></script>
<script src="js/app.js"></script>
</head>
<body ng-app='starter'>
This is GeoLocation App
<!-- your app's js -->
<script src="js/app.js"></script>
<script type="text/javascript">
function showlocation() {
navigator.geolocation.getCurrentPosition(callback);
}
function callback(position) {
document.getElementById('latitude').innerHTML = position.coords.latitude;
document.getElementById('longitude').innerHTML = position.coords.longitude;
}
</script>
<input type="button" value="Show Location"
onclick="javascript:showlocation()" /> <br/>
Latitude: <span id="latitude"></span> <br/>
Longitude: <span id="longitude"></span>
</body>
</html>
这是style.css:
angular.module('starter', ['ionic'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
答案 0 :(得分:1)
如果您的设备是Android,那么......
将您的设备连接到计算机,然后转到chrome://inspect/#devices
。在那里,您可以将您的Ionic应用程序调试为网站,并查看导致问题的原因。
要检查设备,您需要启用USB调试 设备
答案 1 :(得分:0)
我有类似的问题,添加地理位置插件解决了我的问题。
Ionic app works with both "ionic serve" and in ionic view, but not with "ionic build ios"
cordova plugin add cordova-plugin-geolocation
允许您的设备上的位置服务进行设置。