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

The Archive Base Latest Questions

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

I have a Service implementing LocationListener listening for both GPS and Network. The application

  • 0

I have a Service implementing LocationListener listening for both GPS and Network.

The application is dependant on a constant location-feed, but it seems when GPS has a hard time getting a locationfix network location doesnt step in.

manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000 * 30,0, LocationReporterService.this);
manager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000 * 60 * 2,0, LocationReporterService.this);

Questions
How do I make sure that I always get a location?
How can I make sure that if I dont get a GPS-location, I get a Network-location?
Is it a known bug?
Should I have 2 services, GPSLocationService and NetworkLocationsService?
Is there a solution to this? 🙂

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

    I agree with most of comments from AlexBottoni good answer, although in some points I can’t suppot him.

    Overview

    First, just to check that you are doing it right…

    You setup the same LocationListener for both providers. To indentify from where you are reciving the location you need to test it like this:

    public void onLocationChanged(Location fix) {
        if(fix.getProvider().equals(LocationManager.GPS_PROVIDER)){
            //here Gps
        } else if(fix.getProvider().equals(LocationManager.NETWORK_PROVIDER)){
            //here Network
        }
    

    Also, you setup a different acquisition frequency. Gps is providing a new location every 30 seconds and Network every 2 minutes.

    As you didn’t impose a minimum distance, you should receive a new Location from each one of the providers (as long as they can get a fix) with the frequency requested. If you don’t receive a fix, is because they weren’t able to acquire one.

    Also, it may takes a little longer then requested to get the fix (mainly with Gps), because it may take some time to shyncronize with satellites and fix a location.

    Fallback

    There is no builted-in fallback from one provider to the other. They are independet, as said by Alex. I’m using the following approach to implement fallback:

    • Register Gps listener and start a timer
    • On every GPS location, restart timer
    • If timer reachs end, register Network listener (Gps listener keeps registered)
    • If new Gps location arrives, unregister Network listener, restart timer

    Preferable Provider

    Although Gps may not be available everyhere, is far most precise then Network. In my town, I get 6 meters accuracy with GPS and 1 Km with Network 🙁

    Two services

    Doesn’t matter where you register the listener, activity or service, separate ot together, as long as you request them and the provider can get a fix, you will get the location (assuming no bugs in application :-))

    Final Notes

    Ensure you have the permissions need (ACCESS_FINE_LOCATION, INTERNET, etc).

    Ensure that phone setup have Network Location enabled (usually default is disable)

    Most Gps receivers support updating information about satellite location, which improves fix time. You can use GPS Satus from the market, to do it.

    Regards.

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

Sidebar

Related Questions

I have a service application which I will be soon implementing a log file.
We are implementing a service/message-bus feature in our SignalR application and have been looking
I'm implementing a service where each user must have his own json/document database. Beyond
What all language components will have to be used for implementing an email service
We're using Spring jdbcTemplate for implementing the service layer right now but at some
i am implementing a service where i have to extract a zip file which
I have a Service Application which has the following web.config file: <?xml version=1.0?> <configuration>
I have a wcf service that is secured using WIF. I'm implementing token caching
I have a web service that is externally facing but I would like it
For a project I'm implementing a SOAP service using Apache Axis2 1.6.2. I have

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.