iPhone上的位置权限警报与PhoneGap [英] Location permission alert on iPhone with PhoneGap

查看:183
本文介绍了iPhone上的位置权限警报与PhoneGap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改警报上的字符串:

How do you change the string on the alert saying:


(应用名称/任何内容)想要使用您当前的位置

(Appname/whatever it is) would like to use your current location

当然,我只想更改appname部分。因为当你使用PhoneGap框架时,字符串是非常丑陋的,像这样:

Of course, I only want to change the appname part. Because when you use the PhoneGap framework, the string is very ugly, something like this:


/ var / mobile / Applications / 157EB70D-4AA7-826E-690F0CBE0F / appname.app / www / index.html

/var/mobile/Applications/157EB70D-4AA7-826E-690F0CBE0F/appname.app/www/index.html

有人有想法吗? / p>

Someone having an idea?

推荐答案

设备准备就绪后,您需要进行地理位置定位。例如,以下Jquery代码将地理定位而没有那种讨厌的警报:

You need to do the geolocation after the device is ready. The following Jquery code, for example, will geolocate without that nasty alert:

$(function(){
  document.addEventListener("deviceready", onDeviceReady, false);
})

function onDeviceReady() {
  navigator.geolocation.getCurrentPosition(onSuccess, onError);     
}

function onSuccess(position) {
  // your callback here 
}

function onError(error) { 
  // your callback here
}

这篇关于iPhone上的位置权限警报与PhoneGap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆