Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:44:27+00:00 2026-06-03T11:44:27+00:00

I use cordova 1.6.1 and try to access the gps. But onSuccess function never

  • 0

I use cordova 1.6.1 and try to access the gps. But onSuccess function never fires or onError either. GPS is on and the signal is there (tested with Maps at the same time). The code must be right because I used the same eventListener for the camera. The camera works perfectly with onSuccess/onError functions.

I run a Nexus S with Android 4.0.4 . BTW I tested the same code on an iPhone device & simulator and it works perfectly but not on Nexus S. Is there something wrong with Android implementation of phone gap? This is the part of the index.html:

  <body>
  <script type="text/javascript">
    document.addEventListener("deviceready", onDeviceReady, false);
function onSuccess(position) {
   alert("onSuccess");  
   $("#lat").html(position.coords.latitude);
   $("#lon").html(position.coords.longitude);   
    }

    function onError(error) {
        alert("ERROR= " + error.message + "ERROR code= " +error.code );
    }
    function onDeviceReady() {
        //navigator.camera.getPicture(onSuccess, onError, { quality: 20, destinationType: Camera.DestinationType.FILE_URI, encodingType: Camera.PictureSourceType.PHOTOLIBRARY });
      navigator.geolocation.getCurrentPosition(onSuccess, onError);

    }   
</script> 

     <p id="lat"></p>
     <p id="lon"></p>   

</body> 

I also tested the watchPosition function but it didn’t work either on Nexus S (also with enableHighAccuracy: true option and the other options but no success).

Thanks!

Edit1: The GPS symbol is also starting to blink and then appears after 1 minute or so, but still no onSussess!

Edit2: Here is the log from the device. It is something with permissions in the sql db but i have the all location permissions added to the AndroidManifest.xml . The —–REAAAAAAAAAADYYYYYYYYYY string comes from the onDeviceREady() function.

--------- beginning of /dev/log/system
W/InputManagerService(  135): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4167b828
I/ActivityManager(  135): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher} from pid 135
--------- beginning of /dev/log/main
D/dalvikvm(  135): GC_FOR_ALLOC freed 512K, 10% free 14081K/15495K, paused 48ms
I/dalvikvm-heap(  135): Grow heap (frag case) to 13.950MB for 129616-byte allocation
D/dalvikvm(  135): GC_FOR_ALLOC freed 51K, 10% free 14156K/15623K, paused 47ms
W/InputManagerService(  135): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@417236b0 (uid=10014 pid=1302)
I/CheckinService(  297): Preparing to send checkin request
I/EventLogService(  297): Accumulating logs since 1335819200143
I/CheckinTask(  297): Sending checkin request (1952 bytes)
D/dalvikvm(  297): GC_CONCURRENT freed 418K, 6% free 10133K/10759K, paused 2ms+32ms
I/CheckinTask(  297): From server: 193 gservices
I/GservicesProvider(  297): main update completed
I/PersonalizationPrefManagerImpl( 1283): Google account found
I/PersonalizationPrefManagerImpl( 1283): Personalization disabled for SIM country code 262
I/SystemUpdateService(  297): cancelUpdate (empty URL)
D/dalvikvm(  297): GC_CONCURRENT freed 295K, 5% free 10240K/10759K, paused 2ms+3ms
I/ActivityManager(  135): START {flg=0x10040000 cmp=com.google.android.gsf/.update.SystemUpdateInstallDialog} from pid 297
W/ActivityManager(  135): Activity start request from 10019 stopped
D/dalvikvm( 1283): GC_CONCURRENT freed 308K, 5% free 9167K/9607K, paused 1ms+3ms
I/ActivityManager(  135): START {flg=0x10040000 cmp=com.google.android.gsf/.update.SystemUpdateDownloadDialog} from pid 297
W/ActivityManager(  135): Activity start request from 10019 stopped
V/SystemUpdateService(  297): onPostExecute: false
I/VoiceImeLanguageUpdater( 1283): #internalUpdateLanguages #56
I/ActivityManager(  135): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.company.mobileApp/.DefaultActivity bnds=[0,556][120,706]} from pid 351
D/dalvikvm(  135): GC_FOR_ALLOC freed 367K, 11% free 14049K/15623K, paused 56ms
D/dalvikvm( 1335): Late-enabling CheckJNI
I/ActivityManager(  135): Start proc com.company.mobileApp for activity com.company.mobileApp/.DefaultActivity: pid=1335 uid=10015 gids={1006, 3003, 1015}
D/dalvikvm(   79): GC_EXPLICIT freed 37K, 4% free 9030K/9347K, paused 4ms+2ms
D/dalvikvm(   79): GC_EXPLICIT freed <1K, 4% free 9030K/9347K, paused 2ms+2ms
D/dalvikvm(   79): GC_EXPLICIT freed <1K, 4% free 9030K/9347K, paused 1ms+2ms
I/dalvikvm( 1335): Turning on JNI app bug workarounds for target SDK version 2...
D/OpenGLRenderer(  351): Flushing caches (mode 1)
D/OpenGLRenderer(  351): Flushing caches (mode 0)
D/dalvikvm(  351): GC_CONCURRENT freed 1344K, 30% free 11721K/16711K, paused 2ms+7ms
I/System.out( 1335): loadUrl(file:///android_asset/www/index.html,1000)
I/CheckinTask(  297): Checkin success: https://android.clients.google.com/checkin (1 requests sent)
D/dalvikvm( 1335): GC_FOR_ALLOC freed 85K, 3% free 9123K/9347K, paused 24ms
I/dalvikvm-heap( 1335): Grow heap (frag case) to 9.564MB for 614416-byte allocation
D/dalvikvm( 1335): GC_CONCURRENT freed 1K, 3% free 9722K/9991K, paused 5ms+2ms
V/PhoneStatusBar(  201): setLightsOn(true)
W/webcore ( 1335): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
W/webcore ( 1335): at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1683)
W/webcore ( 1335): at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:926)
W/webcore ( 1335): at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1795)
W/webcore ( 1335): at android.webkit.WebView.sendOurVisibleRect(WebView.java:2917)
W/webcore ( 1335): at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:593)
W/webcore ( 1335): at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
W/webcore ( 1335): at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:984)
W/webcore ( 1335): at android.os.Handler.handleCallback(Handler.java:605)
W/webcore ( 1335): at android.os.Handler.dispatchMessage(Handler.java:92)
W/webcore ( 1335): at android.os.Looper.loop(Looper.java:137)
W/webcore ( 1335): at android.app.ActivityThread.main(ActivityThread.java:4424)
W/webcore ( 1335): at java.lang.reflect.Method.invokeNative(Native Method)
W/webcore ( 1335): at java.lang.reflect.Method.invoke(Method.java:511)
W/webcore ( 1335): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
W/webcore ( 1335): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
W/webcore ( 1335): at dalvik.system.NativeStart.main(Native Method)
I/ActivityManager(  135): Displayed com.company.mobileApp/.DefaultActivity: +1s484ms
I/System.out( 1335): loadUrl(file:///android_asset/www/index.html)
I/System.out( 1335): url=file:///android_asset/www/index.html baseUrl=file:///android_asset/www
D/dalvikvm( 1335): GC_CONCURRENT freed 120K, 3% free 10099K/10311K, paused 2ms+7ms
D/chromium( 1335): Unknown chromium error: -6
I/SqliteDatabaseCpp( 1335): sqlite returned: error code = 14, msg = cannot open file at line 27701 of [8609a15dfa], db=/data/data/com.company.mobileApp/databases/webview.db
I/SqliteDatabaseCpp( 1335): sqlite returned: error code = 14, msg = os_unix.c: open() at line 27701 - "" errno=2 path=/CachedGeoposition.db, db=/data/data/com.company.mobileApp/databases/webview.db
D/androidNetworkLocationListeners(  297): Still have listener com.google.android.location.internal.client.NetworkLocationClient$1@4137a068
D/androidNetworkLocationListeners(  297): Still have listener com.google.android.location.internal.client.NetworkLocationClient$1@4137a068
I/Web Console( 1335): -------------------------------REAAAAAAAAAADYYYYYYYYYY----------- at file:///android_asset/www/index.html:42
W/InputManagerService(  135): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@417419e8
D/dalvikvm( 1335): GC_CONCURRENT freed 640K, 8% free 9869K/10631K, paused 1ms+5ms
D/dalvikvm(  201): GC_FOR_ALLOC freed 143K, 28% free 10116K/13895K, paused 16ms
D/dalvikvm(  201): GC_FOR_ALLOC freed 364K, 28% free 10108K/13895K, paused 17ms
D/dalvikvm(  201): GC_CONCURRENT freed 318K, 27% free 10249K/13895K, paused 2ms+3ms
D/dalvikvm(  201): GC_CONCURRENT freed 501K, 27% free 10159K/13895K, paused 1ms+2ms
I/WifiLocationEstimator(  297): Not returning location for the following outliers: [127755693135544]
I/SqliteDatabaseCpp( 1335): sqlite returned: error code = 14, msg = cannot open file at line 27701 of [8609a15dfa], db=/data/data/com.company.mobileApp/databases/webview.db
I/SqliteDatabaseCpp( 1335): sqlite returned: error code = 14, msg = os_unix.c: open() at line 27701 - "" errno=2 path=/GeolocationPermissions.db, db=/data/data/com.company.mobileApp/databases/webview.db
D/dalvikvm(  297): GC_CONCURRENT freed 552K, 7% free 10143K/10823K, paused 2ms+4ms
I/ActivityManager(  135): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher} from pid 135
D/dalvikvm(  135): GC_FOR_ALLOC freed 397K, 9% free 14239K/15623K, paused 50ms
I/dalvikvm-heap(  135): Grow heap (frag case) to 14.104MB for 129616-byte allocation
D/dalvikvm(  135): GC_FOR_ALLOC freed 70K, 10% free 14295K/15751K, paused 48ms
W/InputManagerService(  135): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@4177e9d0 (uid=10015 pid=1335)
I/ActivityManager(  135): No longer want com.android.voicedialer (pid 1138): hidden #16
I/ActivityManager(  135): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=org.jtb.alogcat cmp=org.jtb.alogcat/.LogActivity bnds=[120,556][240,706]} from pid 351
D/dalvikvm(  135): GC_FOR_ALLOC freed 185K, 10% free 14181K/15751K, paused 52ms
D/OpenGLRenderer(  351): Flushing caches (mode 1)
D/OpenGLRenderer(  351): Flushing caches (mode 0)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:44:29+00:00Added an answer on June 3, 2026 at 11:44 am

    Ok. I packaged the app with phonegap build service and now it works. It was something wrong with packaging.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on PhoneGap for android and it use cordova-1.5.0.jar, I want to
I'm trying to use PhoneGap DatePicker plugin (PhoneGap 1.5 (Cordova) in Xcode 4.2) for
I'm building a PhoneGap 1.5 (Cordova) application for iOS and want to use the
use this website a lot but first time posting. My program creates a number
Use case: we have some project meta-data files which we want tracked, but are
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
use a reapeter to display data, but sometimes the data is to big to
Use of function calls in where clause of stored procedure slows down performance in
Use new MediaPlayer by Yahoo. Content parse automatic - greate, but I use ajax
Use PHP and MySQL. In my table, there is date field (datetime) recorded by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.