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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:19:33+00:00 2026-06-01T12:19:33+00:00

I’ve written a mapping application which uses GPS. Testing this on my phone (a

  • 0

I’ve written a mapping application which uses GPS. Testing this on my phone (a Galaxy S2 running Gingerbread) I could see no change in behaviour according to the values set in the minTime and minDistance arguments – the GPS, as indicated by the system icon stayed on after a fix no matter what minTime was set.

Aware from the SDK docs, that these were only ‘hints’, I wrote my own battery conservation regime by delegating the GPS control to a service with an IBinder which the activities could bind to and receive location updates by means of a BroadcastReceiver. A ‘settings’ menu option activity set parameters (‘GPS sleep time’ and ‘required accuracy’ which would turn off the GPS in the service for the sleep time once the accuracy criterion was satisfied. For completeness I also passed in minTime and minDistance parameters, which based on my empirical evidence I assumed would be redundant. I did my best to explain the effect of these settings in one of the app’s help pages:

enter image description here

Now my phone has just been upgrade to to ICS, I do find that the minTime does affect the state of the GPS (at least as reflected by the satellite icon on the status bar). In fact it disappears for almost exactly the set time after a fix.

I’m now in a quandary as to what to expect from any particular device/OS version combination and how to adapt my app to cope. To try and resolve it I’ll ask two specific questions:

Has any developer observed such a change in behaviour in their device when changing from Gingerbread to ICS?

Is such a change documented anywhere?

All factually based answers will be appreciated.

UPDATE 3rd April – smallest code sample I can produce to demonstrate behaviour of device appended below

public class GPSParamTestActivity extends Activity implements LocationListener,
        GpsStatus.Listener {

    private LocationManager mLocMgr;
    private long mUpdatePeriod = 10000; // 10 seconds
    private TextView mLocTV,  mStatTV, mGPSStatTV; // 3 TextViews for o/p
    private boolean mStatColourToggle, mLocnColourToggle, mGPSStatColourToggle;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        // Layout at http://dl.dropbox.com/u/67134160/main.xml if needed
    }

    @Override
    protected void onResume() {
        super.onResume();
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        mLocTV = (TextView) findViewById(R.id.locnTV);
        mStatTV = (TextView) findViewById(R.id.statusTV);
        mGPSStatTV = (TextView) findViewById(R.id.gpsStatusTV);
        mLocMgr = (LocationManager) getSystemService(LOCATION_SERVICE);
    }

    @Override
    protected void onPause() {
        mLocMgr.removeGpsStatusListener(this);
        mLocMgr.removeUpdates(this); // Don't leave GPS on 
        super.onPause();
    }

    @Override
    public void onGpsStatusChanged(int event) {// GpsStatus.Listener fires this one
        mGPSStatTV.setTextColor(mGPSStatColourToggle ? Color.RED : Color.BLUE);
        mGPSStatColourToggle = !mGPSStatColourToggle;
        String str = "";
        switch (event) {
            case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
                str = "GPS_EVENT_SATELLITE_STATUS";
                break; 
            case GpsStatus.GPS_EVENT_FIRST_FIX:
                str = "GPS_EVENT_FIRST_FIX";
                break;
            case GpsStatus.GPS_EVENT_STARTED:
                str = "GPS_EVENT_STARTED";
                break;
            case GpsStatus.GPS_EVENT_STOPPED:
                str = "GPS_EVENT_STOPPED";
                break;
        }
        mGPSStatTV.setText(str);
    }

    @Override
    public void onLocationChanged(Location loc) {
        mLocTV.setTextColor(mLocnColourToggle ? Color.RED : Color.BLUE);
        mLocnColourToggle = !mLocnColourToggle;
        String str = null;
        NumberFormat formatter = new DecimalFormat("##0.000000");
        String fLat = formatter.format(loc.getLatitude());
        String fLon = formatter.format(loc.getLongitude());
        str = "Lat/Lon " + fLat + "/" + fLon;
        mLocTV.setText(str);
    }

    @Override public void onProviderDisabled(String provider) {}
    @Override public void onProviderEnabled(String provider) {}

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {
        // This is never triggered on a Galaxy S2, G'bread or ICS
        mStatTV.setTextColor(mStatColourToggle ? Color.RED : Color.BLUE);
        mStatColourToggle = !mStatColourToggle;
        String str = "Status chg " + provider;
        switch (status) {
            case android.location.LocationProvider.OUT_OF_SERVICE:
                str += " OUT OF SERVICE";
                break;
            case android.location.LocationProvider.AVAILABLE:
                str += " AVAILABLE";
                break;
            case android.location.LocationProvider.TEMPORARILY_UNAVAILABLE:
                str += " TEMPORARILY UNAVAILABLE";
                break;
            default:
                str += " UNKNOWN STATUS";
        }
        mStatTV.setText(str);
    }

    public void myClickHandler(View target) {
        mLocMgr.removeGpsStatusListener(this); // stop all listeners
        mLocMgr.removeUpdates(this);           // by default 
        // 3 buttons for app control, set the listeners to here in the XML
        switch (target.getId()) {
            case R.id.stopGPSButton:
                break; // already done by default
            case R.id.tenSecStartButton:
                mLocMgr.addGpsStatusListener(this);
                mLocMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER,
                        mUpdatePeriod, 0, (LocationListener) this);
                break;
            case R.id.zeroSecStartButton:
                mLocMgr.addGpsStatusListener(this);
                mLocMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER,
                        0, 0, (LocationListener) this);
                break;
        }
    }
}

.

  • 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-01T12:19:35+00:00Added an answer on June 1, 2026 at 12:19 pm

    While it’s not a real answer this post may be interesting:

    I believe I’ve narrowed down the problem to faulty capability
    reporting from native code to the GpsLocationProvider in the Android
    platform. In a custom AOSP build on the same Nexus S 4G, I hard-coded
    values in the GpsLocationProvider to indicate that the native code was
    NOT capable of handling GPS scheduling. Voila, the platform took over
    and properly followed the minTime parameter (60 seconds in this case)
    and delivered location updates to the app 60 seconds apart.
    So, it seems to me that the native code is telling the platform “I can
    handle GPS scheduling”, but then it doesn’t, resulting in a 1Hz update
    rate no matter the minTime interval requested by the application.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I would like to run a str_replace or preg_replace which looks for certain words

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.