你如何更改警报上的字符串说:
(Appname /无论是什么)想要使用您当前的位置
当然,我只想更改appname部分.因为当你使用PhoneGap框架时,字符串非常难看,如下所示:
/var/mobile/Applications/157EB70D-4AA7-826E-690F0CBE0F/appname.app/www/index.html
有人有想法吗?
我使用插件cordova-plugin-geolocation.我唯一的问题是允许位置的消息提示如下所示:
/var/container/bundle/application/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/my_project/www/index.html想要使用您的位置.
反正有没有更性感的东西,比如说
my_project想要使用你的位置
干杯.
为非信徒添加了一些代码
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
navigator.geolocation.getCurrentPosition(onLocationSuccess, onLocationError, {maximumAge:3000, timeout:2000, enableHighAccuracy:true});
function onLocationSuccess(){
}
function onLocationError(){
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个 Cordova 应用程序,它做的第一件事就是在应用程序启动时检查用户的位置。问题是,如果这是用户第一次启动应用程序(在 iOS 上),地理定位插件不会等待用户对 iOS 显示的地理权限对话框说是或否。
无论如何我可以让这个插件功能等待用户说允许或禁止地理权限吗?
有问题的插件https://github.com/apache/cordova-plugin-geolocation
示例函数调用:
navigator.geolocation.getCurrentPosition(geolocationSuccess,geolocationError,geolocationOptions);
Run Code Online (Sandbox Code Playgroud)
当我第一次启动应用程序时,我收到了 iOS 权限提示,但我可以在后台看到函数调用已经进入错误函数。
我正在研究一个cordova app我必须经过locate the user纬度和经度的东西。使用地理定位插件,它在 android 设备上运行良好,但它显示一个警报,要求用户在iOS. 当我使用模拟器时,我收到此警报消息:
Users/user/Library/Developer/CoreSimulator/Devices/783A2EFD-2976-448C-8E4E-841C985D337D/data/Containers/Bundle/Application/EFC846BB-4BA3-465C-BD44-575582E649FC/app_name.app/www/index.html would like to use your current location.
Run Code Online (Sandbox Code Playgroud)
我看到过这样的话题谈论这个问题:这个和这个但是提供的解决方案都不适合我。
这是cordova示例页面:
<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
function onSuccess(position) {
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
'Longitude: ' + position.coords.longitude + '<br />' +
'Altitude: ' + position.coords.altitude + …Run Code Online (Sandbox Code Playgroud)