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 4267608
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:55:22+00:00 2026-05-21T06:55:22+00:00

I am targeting Android 1.6 The LocationManager and listener are implemented within a Service

  • 0

I am targeting Android 1.6

The LocationManager and listener are implemented within a Service

requestLocationUpdates() is used as follows:

                locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 
                                                       //3 mins
                                                       Constants.LOCATION_UPDATE_PERIOD_MSEC,
                                                       //no distance is necessary
                                                       0,
                                                       locationListener);

The Location Manager and Listener are implemented as follows:

    locationManager = (LocationManager) getSystemService(GPS_Service.this.LOCATION_SERVICE);    

    locationListener = new GPSlocListener(mHandler, Constants.LOCATION_UPDATE_TIME, true);

my implementation of the LocationListener:

public class GPSlocListener implements LocationListener 
{
    //constructor
    public GPSlocListener(Handler parentMsgHandler, long timeBetweenLocationEvents, boolean accuracyOverride)
    {
    //store passed-in values in member variables
    }

    public void onLocationChanged(Location loc)
    {
        Log.d(TAG, "onLocationChanged() called.");

        //process the data and send the location to the parentMsgHandler
    }

    public void onProviderDisabled(String provider)
    {
        // TODO Auto-generated method stub
    }

    public void onProviderEnabled(String provider)
    {
        // TODO Auto-generated method stub
    }

    public void onStatusChanged(String provider, int status, Bundle extras)
    {
        // TODO Auto-generated method stub
    }
}

Sometimes onLocationChanged is triggered in 3 minute intervals, and sometimes at least 10 minutes can pass (possibly longer).
I’ll monitor the app and the little satellite icon shows up regularly. But, onLocationChanged() isn’t reliably called.

some logging info:

04-07 22:08:58.945: DEBUG/GpsLocationProvider(107): Acquiring wakelock
04-07 22:08:59.186: DEBUG/libgps(107): report status : 3
04-07 22:09:05.155: DEBUG/dalvikvm(228): GC_EXPLICIT freed 13 objects / 536 bytes in 88ms
04-07 22:09:14.997: DEBUG/libgps(107): PDSM_PD_EVENT_UPDATE_FAILURE 
04-07 22:09:15.005: DEBUG/libgps(107): report status : 2
04-07 22:09:15.025: DEBUG/libgps(107): report status : 1
04-07 22:09:16.035: DEBUG/libgps(107): report status : 4
04-07 22:09:16.035: DEBUG/libgps(107): report status : 3
04-07 22:09:16.035: DEBUG/libgps(107): report status : 3
04-07 22:09:31.065: DEBUG/libgps(107): report status : 2
04-07 22:09:31.125: DEBUG/libgps(107): report status : 1
04-07 22:09:32.145: DEBUG/libgps(107): report status : 4
04-07 22:09:32.145: DEBUG/libgps(107): report status : 3
04-07 22:09:32.145: DEBUG/libgps(107): report status : 3
04-07 22:09:47.165: DEBUG/libgps(107): report status : 2
04-07 22:09:47.185: DEBUG/libgps(107): report status : 1
04-07 22:09:48.195: DEBUG/libgps(107): report status : 4
04-07 22:09:48.381: DEBUG/libgps(107): report status : 3
04-07 22:09:48.381: DEBUG/libgps(107): report status : 3
04-07 22:09:48.615: DEBUG/LocationManagerService(107): CdmaCellLocation Available
04-07 22:09:48.625: VERBOSE/AlarmManager(107): Adding Alarm{46208250 type 2 com.google.android.apps.maps} Dec 13 12:46:54 pm
04-07 22:09:51.855: DEBUG/LocationManagerService(107): CdmaCellLocation Available
04-07 22:09:51.865: VERBOSE/AlarmManager(107): Adding Alarm{461e4e88 type 2 com.google.android.apps.maps} Dec 13 12:46:54 pm
04-07 22:09:56.895: DEBUG/dalvikvm(206): GC_EXPLICIT freed 172 objects / 6912 bytes in 58ms
04-07 22:09:58.915: VERBOSE/AlarmManager(107): Alarm triggering: Alarm{464f6cc8 type 2 android}
04-07 22:09:58.925: DEBUG/GpsLocationProvider(107): ALARM_TIMEOUT
04-07 22:09:58.925: DEBUG/GpsLocationProvider(107): stopNavigating
04-07 22:09:58.925: DEBUG/libgps(107): qct_gps_stop
04-07 22:09:58.925: DEBUG/libgps(107): report status : 2
04-07 22:09:58.925: VERBOSE/AlarmManager(107): Adding Alarm{46540430 type 2 android} Jan 01 05:22:56 am
04-07 22:10:00.965: DEBUG/libgps(107): report status : 4
04-07 22:10:00.965: DEBUG/GpsLocationProvider(107): Releasing wakelock

and the permissions:

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

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

and to give you an idea, this is a typical result:

04-07 21:42:46.985: DEBUG/GPSlocListener(2582): onLocationChanged() called. 
04-07 21:42:58.515: DEBUG/GPSlocListener(2582): onLocationChanged() called.
04-07 21:45:14.825: DEBUG/GPSlocListener(2582): onLocationChanged() called. 
04-07 21:48:14.865: DEBUG/GPSlocListener(2582): onLocationChanged() called. 
04-07 21:48:26.205: DEBUG/GPSlocListener(2582): onLocationChanged() called.
04-07 21:48:57.815: DEBUG/GPSlocListener(2582): onLocationChanged() called. 
04-07 21:54:30.995: DEBUG/GPSlocListener(2582): onLocationChanged() called.
04-07 21:54:42.375: DEBUG/GPSlocListener(2582): onLocationChanged() called. 
04-07 21:54:54.395: DEBUG/GPSlocListener(2582): onLocationChanged() called. 
  • 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-05-21T06:55:23+00:00Added an answer on May 21, 2026 at 6:55 am

    The onLocationChanged will be triggered when the location of the device changes. if you are sitting in one place and the location has not changed, then the onLocationChanged might not be triggered. So of that is the case then your program is working fine and LocationManager is also behaving as expected.

    Try changing the Log.d to show a toast as your location is changed and try walking or moving your position. You will see the updated location toasts as your location changes. Try decreasing the minimum interval for your test cases ;). Also keep in mind that GPS locations will not be accurate if you are fetching the location when you are in a building.

    Achie.

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

Sidebar

Related Questions

I have developed an Android application targeting Android 2.2 now I want to make
I developed one simple android application targeting the Mobiles with android 2.0 OS.I want
I want to develop an app targeting Android version 2.1 (6) and above so
I'm using android-mips-ndk-r5b-windows and latest sdk , I'm targeting Android 2.2 cygwin 1.79 the
I am one step away from making the method described here: Targeting Android with
I'm developing an Android application that is targeting API level 8 (2.2, Froyo). I'm
This is my first attempt at an Android app. I'm targeting Android 4/Ice Cream
I have implemented admob code as given in google site (http://code.google.com/mobile/ads/docs/android/fundamentals.html) as described in
I am targeting my application to be able run across Android 1.5 till 2.3.
My render code is written in C++, I am targeting android 1.6. I feel

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.