Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-5934

Geolocation not working in Galaxy S3 mini (Android)

    XMLWordPrintableJSON

    Details

      Description

      I testing a simple app of Geolocation in my device, but it not working.

      HTML:

      <!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">

      // Wait for device API libraries to load
      //
      document.addEventListener("deviceready", onDeviceReady, false);

      var watchID = null;

      // device APIs are available
      //
      function onDeviceReady() {
      // Get the most accurate position updates available on the
      // device.
      var options =

      { enableHighAccuracy: true }

      ;
      watchID = navigator.geolocation.watchPosition(onSuccess, onError, options);
      }

      // onSuccess Geolocation
      //
      function onSuccess(position)

      { var element = document.getElementById('geolocation'); element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' + 'Longitude: ' + position.coords.longitude + '<br />' + 'Timestamp: ' + position.timestamp; // '<hr />' + element.innerHTML; }

      // clear the watch that was started earlier
      //
      function clearWatch() {
      if (watchID != null)

      { navigator.geolocation.clearWatch(watchID); watchID = null; }

      }

      // onError Callback receives a PositionError object
      //
      function onError(error)

      { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); }

      </script>
      </head>
      <body>
      <p id="geolocation">Watching geolocation...</p>
      <button onclick="clearWatch();">Clear Watch</button>
      </body>
      </html>

      ---------------------------------

      This is my "AndroidManifest.xml"

      <?xml version='1.0' encoding='utf-8'?>
      <manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="it.test.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" />
      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
      <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
      <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
      <application android:allowBackup="false" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
      <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="GeolocationTest" android:theme="@android:style/Theme.Black.NoTitleBar">
      <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      </activity>
      </application>
      </manifest>

      ------------------------------------

      This is my "/platforms/android/assets/www/config.xml"

      <?xml version='1.0' encoding='utf-8'?>
      <widget id="it.test.geo" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
      <name>Hello Cordova</name>
      <description>
      A sample Apache Cordova application that responds to the deviceready event.
      </description>
      <preference name="loglevel" value="DEBUG" />
      <feature name="App">
      <param name="android-package" value="org.apache.cordova.App" />
      </feature>
      <feature name="Geolocation">
      <param name="android-package" value="org.apache.cordova.geolocation.GeoBroker" />
      </feature>
      <name>GeolocationTest</name>
      <description>
      Geolocation Test.
      </description>
      <author email="test@test.it" href="http://www.test.com">
      test test
      </author>
      <content src="index.html" />
      <access origin="*" />
      </widget>

      ps. I add manually the lines of feature... is that correct??

      Thanks for your help,
      Kevin

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kevinoo Kevin Lucich
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: