index.js कोड:त्रुटि कोड 3 समय समाप्त जब मैं एंड्रॉयड
// debug
function d(s) {
console.log(s);
$("#status").text(s);
}
// geo
function geoWin(pos) {
d("geoWin(): "+pos.coords.latitude+", "+pos.coords.longitude+","+pos.coords.speed);
}
function geoFail(error) {
d("geoFail(): "+error.code+": "+error.message);
}
function startGeoWatch() {
d("startGeoWatch()");
opt = {maximumAge: 0,timeout: 2000, enableHighAccuracy: true};
watchGeo = navigator.geolocation.watchPosition(geoWin, geoFail, opt);
}
function stopGeoWatch() {
d("stopGeoWatch()");
navigator.geolocation.clearWatch(watchGeo);
}
// life cycle
function onPause() {
d("onPause()");
stopGeoWatch();
}
function onResume() {
d("onResume()");
startGeoWatch();
}
// init
function onDeviceReady() {
d("onDeviceReady()");
document.addEventListener("pause", onPause, false);
document.addEventListener("resume", onResume, false);
startGeoWatch();
}
function main() {
document.addEventListener('deviceready', onDeviceReady, false);
}
// main & globals
var watchGeo=null;
main();
मेरी config.xml कोड:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.terokarvinen.geo" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" version="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-geolocation" spec="~2.2.0" />
</widget>
AndroidManifest कोड:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.terokarvinen.geo" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>
जबकि मैं इस एप्लिकेशन को फ़ायरफ़ॉक्स में चलाने का प्रयास करता हूं, यह मेरा सटीक भौगोलिक स्थान देता है। लेकिन जब मैं इस एप्लिकेशन को चलाने की कोशिश करता हूं एंड्रॉइड डिवाइस। हमेशा टाइमआउट की अवधि समाप्त हो जाती है। मुझे कंसोल में कोई त्रुटि नहीं है।
मैं अपने आवेदन एंड्रॉयड .मैं के जीपीएस सेवा है जो जीपीएस अनुरोध में अपने आवेदन है स्थान मेनू में जाँच की थी कि अनुरोध किया जाता है परीक्षण किया था।
क्या आप डिवाइस में परीक्षण के लिए अपनी परियोजना को जिथब में साझा कर सकते हैं? – Gandhi
सुनिश्चित करें कि मैं आपके लिए एक लिंक अपलोड करूंगा। –
एंड्रॉइड पर आपने किस ब्राउजर को आजमाया था? –