incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lucas Falk Beier (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-603) Phonegap didn't trigger GPS
Date Mon, 30 Apr 2012 01:34:47 GMT
Lucas Falk Beier created CB-603:
-----------------------------------

             Summary: Phonegap didn't trigger GPS
                 Key: CB-603
                 URL: https://issues.apache.org/jira/browse/CB-603
             Project: Apache Callback
          Issue Type: Bug
          Components: Android
    Affects Versions: 1.6.1, 1.6.0, 1.7.0
            Reporter: Lucas Falk Beier
            Assignee: Joe Bowser


I'm trying to get my position with GPS.

I just implement the "Full Example" from here: http://docs.phonegap.com/en/1.6.1/cordova_geolocation_geolocation.md.html#Geolocation

I tested with 1.6.0, 1.6.1 and 1.7.0rc1.

The problem: app didn't trigger the GPS to get my current position. When I check "Data enable",
it works, but I don't want to use 3G, I want to use only GPS to get my current position.

Here is my code:
<!DOCTYPE html>
<html>
  <head>
    <title>Device Properties Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova-1.6.0.js"></script>
    <script type="text/javascript" charset="utf-8">

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

    // Cordova is ready
    //
    function onDeviceReady() {
        navigator.geolocation.getCurrentPosition(onSuccess, onError);
    }

    // onSuccess Geolocation
    //
    function onSuccess(position) {
        var element = document.getElementById('geolocation');
        element.innerHTML = 'Latitude: '           + position.coords.latitude            
 + '<br />' +
                            'Longitude: '          + position.coords.longitude           
 + '<br />' +
                            'Altitude: '           + position.coords.altitude            
 + '<br />' +
                            'Accuracy: '           + position.coords.accuracy            
 + '<br />' +
                            'Altitude Accuracy: '  + position.coords.altitudeAccuracy    
 + '<br />' +
                            'Heading: '            + position.coords.heading             
 + '<br />' +
                            'Speed: '              + position.coords.speed               
 + '<br />' +
                            'Timestamp: '          + new Date(position.timestamp)        
 + '<br />';
    }

    // onError Callback receives a PositionError object
    //
    function onError(error) {
        alert('code: '    + error.code    + '\n' +
              'message: ' + error.message + '\n');
    }

    </script>
  </head>
  <body>
    <p id="geolocation">Finding geolocation...</p>
  </body>
</html>

And the XML file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.phonegap.helloworld"
    android:versionCode="1"
    android:versionName="1.0" >
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<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" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />

    <uses-sdk android:minSdkVersion="7" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".App"
            android:label="@string/app_name"
            android:configChanges="orientation|keyboardHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="org.apache.cordova.DroidGap" android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"> <intent-filter> </intent-filter>
</activity>
    </application>
</manifest>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message