抱歉英语不好。
我已经开发了一个基于Phonegap(适用于Android)的APP。我在三星平板电脑和联想平板电脑上运行它并且工作正常(它适用于来自 phonegap 的 GPS 代码)。当我在智能手机 Samsun Galaxy S4 上运行时,GPS 不适用于该应用程序(不在添加的谷歌地图上显示地理位置)。
我应该做任何其他配置吗?
谢谢你的答案...
再次,抱歉英语不好。
编辑:
代码 HTML 地图画布:
<body onLoad="initialize()">
<div data-role="header" data-theme="c" data-position="fixed" data-tap-toggle="false">
<a href="" data-rel="back" data-role="button" data-icon="back" data-iconpos="notext" data-transition="slide">Atrás</a>
<center style="margin-top: 5px; margin-bottom: 5px;">
<img src="../../img/TargetHR.png" width="65%" height="10%" />
</center>
</div>
<div data-role="content" height="100%">
<center>
<table width="80%" height="30%" >
<tr>
<td
style="height: 70px; font-size: 1em; color: #4A6169; line-height: 27px">
<b>Nombres: </b> Edgar Luis<br />
<b>Apellidos: </b> Padilla Rivera<br />
<b>Fecha / Hora: </b> <br />
<b>Estado: </b> <div id="estado" style="display: inline;"></div><br />
</td>
<td align="center"> <div id="btnRegistro" data-role="button" data-mini="true">Registrar</div> </td>
</tr>
</table><br/>
</center>
<div id="map-canvas" style="height:600px; width: 100%;"></div>
</div>
代码 .JS(主体初始化()):
函数初始化(){
if(google === undefined) {
alert("Google Maps no se ha cargado");
} else {
// OPCIONES DEL MAPA
var mapOptions = {
center : new google.maps.LatLng(-12.105833, -76.970801),
zoom : 17,
panControl : true,
zoomControl : true,
scaleControl : true,
streetViewControl : true,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
map.setTilt(45);
// POLIGONO OFICINA - PUNTOS
var poligono = [
new google.maps.LatLng(-12.106510, -76.970516),
new google.maps.LatLng(-12.106421, -76.970409),
new google.maps.LatLng(-12.106476, -76.970360),
new google.maps.LatLng(-12.106554, -76.970465) ];
// POLIGONO OFICINA - PINTAR EN MAPA
var of = new google.maps.Polygon({
paths : poligono,
strokeColor : "#FF0000",
strokeOpacity : 0.8,
strokeWeight : 2,
fillColor : "#FF0000",
fillOpacity : 0.35
});
of.setMap(map);
// POLIGONO EDIFICIO - PUNTOS
var edificio = [
new google.maps.LatLng(-12.105181, -76.971031),
new google.maps.LatLng(-12.105052, -76.970988),
new google.maps.LatLng(-12.105013, -76.971087),
new google.maps.LatLng(-12.105129, -76.971138) ];
// POLIGONO EDIFICO - PINTAR EN MAPA
var ed = new google.maps.Polygon({
paths : edificio,
strokeColor : "#FF0000",
strokeOpacity : 0.8,
strokeWeight : 2,
fillColor : "#FF0000",
fillOpacity : 0.35
});
ed.setMap(map);
// MOVIL
navigator.geolocation.getCurrentPosition(onSuccess, onError);
var latMovil, lonMovil;
function onSuccess(position){
latMovil = position.coords.latitude;
lonMovil = position.coords.longitude;
//latMovil = -12.105677;
//lonMovil = -76.970806;
var LatLonMOV = new google.maps.LatLng(latMovil, lonMovil);
var icono = "../../img/phones.png";
var marker = new google.maps.Marker({
position : LatLonMOV,
icon : new google.maps.MarkerImage(icono),
map : map
});
if (of.Contains(LatLonMOV)) {
$("#estado").html("Apto para asistencia");
$("#btnRegistro").show();
} else {
if (ed.Contains(LatLonMOV)){
$("#estado").html("Apto para asistencia");
$("#btnRegistro").show();
} else {
$("#estado").html("ZONA INVÁLIDA PARA EL REGISTRO");
$("#btnRegistro").hide();
}
}
}
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
}
}
AndroidManifest.xml
`
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.version.Main_Activity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
`
该应用程序的作用是什么?:限制一个区域(您所在的位置)在公司系统中注册帮助。该区域由一些多边形设置。
在这里,来自平板电脑的 SS(GPS“工作”)和智能手机 http://imageshack.us/g/541/ylce.png/