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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:58:18+00:00 2026-06-10T03:58:18+00:00

I have problem with gps implementation on Android. The problem is GPS lose fix.

  • 0

I have problem with gps implementation on Android. The problem is GPS lose fix. The location icon is pulsing, after few seconds toast shows with position and then GPS lose fix and try to connect again.

My service:

public class LocationService extends Service {

    private static final long MIN_TIME = 15000;
    private static final float MIN_DISTANCE = 1;

    private final IBinder binder = new LocalBinder();

    private LocationManager locationManager;

    @Override
    public void onCreate() {
        super.onCreate();

        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);     
    }

    @Override
    public IBinder onBind(Intent intent) {
        return binder;
    }

    public class LocalBinder extends Binder {
        LocationService getService() {
            return LocationService.this;
        }
    }

    public void setListener(LocationListener listener) {
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_TIME, MIN_DISTANCE, listener);
    }

    public void removeListener(LocationListener listener) {
        locationManager.removeUpdates(listener);
    }
}

My activity:

public class MainMapActivity extends CustomMapActivity implements LocationListener {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map_layout);

        Intent i = new Intent(this, LocationService.class);
        startService(i);
        bindService(i, conn, BIND_AUTO_CREATE);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        unbindService(conn);
    }

    ServiceConnection conn = new ServiceConnection() {

        @Override
        public void onServiceDisconnected(ComponentName name) {

        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            // TODO Auto-generated method stub
            serv = ((LocalBinder)service).getService();
            serv.setListener(MainMapActivity.this);
        }
    };

    @Override
    public void onLocationChanged(Location location) {
        Toast.makeText(this, Double.toString(location.getLatitude())+Double.toString(location.getLongitude()),     Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onProviderDisabled(String provider) {

    }

    @Override
    public void onProviderEnabled(String provider) {

    }

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {

    }
}

It is not a problem with device, because in Google Map App it works perfect.

Thanks for help

  • 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-10T03:58:20+00:00Added an answer on June 10, 2026 at 3:58 am

    You have passed a minimum time parameter of 15 seconds to the location listener. In most devices/OS versions this will turn off the GPS for that amount of time before re-enabling it.

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

Sidebar

Related Questions

I have problem with repopulating form_upload after validation. Other input fields or selectboxes are
i have a problem with double values i need to store in an android
I have an application where a javascript reads the GPS location of the device
In Android, I have some code to check whether the user has GPS switched
I have problem with my Android application. I need an application that will send
I have created a GPS service which reads location updates on a regular interval.
I have a problem I can not solve, when the GPS data logger is
I have a problem recieving notifications from LocationManager after a set period of time:
I have a problem in getting the user's location (my location). My code is
I have a little problem... I have made an Android application which extends the

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.