Well I am not using them at the same time. Here is my process.

1) Start with GPS, set timer for 30 seconds. If GPS has not got a location
in that time my timer goes off and stops the GPS. I then request the Passive
provider. I allow again 30 seconds for that. If nothing happens in 30
seconds the timer goes off, and starts my Network Provider.

2) Once the network provider gets called nothing happens it just sits there.

3) If I bypass the GPS and Passive the network provider works as it is
suppose to.

I am just trying to find out if I am doing something wrong or maybe there is
a bug that screws the network provider up if the GPS provider has been
requested and stopped before hand. Below is my original post with my code
included:

Hey,

Right now when trying to get a user location I start with the GPS Provider.
I have a timer set for 30 seconds, If a location is not found in 30 seconds
the timer goes off and stops that location request. When that happens I move
to the Passive Provider. After 30 seconds if a location is not found I stop
the location request and move to the Network Provider.

My issue is that when the network provider gets called it never does
anything. If I start with the network provider it goes off just fine and
returns a location back to me. Below is the code I am trying to use:

gpsTimer.schedule(new TimerTask(){
                  @Override
                  public void run() {
                        
                        startPassive();
                        
                        
                  }
            }, 30000);
            
            currentTimer = "GPS";
 
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
locationListener);

private void startPassive(){
            
            locationManager.removeUpdates(locationListener);
            
            //Now we want to try for a Passive Fix
            currentTimer = "Passive";
            passiveTimer.schedule(new TimerTask(){

                  @Override
                  public void run() {
                        startNetwork();
                  }
                  
            }, 30000);
            Looper.prepare();
            Looper.myLooper().quit();
 
locationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 0,
0, locationListener);

private void startNetwork(){
            locationManager.removeUpdates(locationListener);
            currentTimer = "Network";
            Looper.prepare();
            Looper.myLooper().quit();
 
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0,
0, locationListener);

any help or suggestions would be greatly appreciated. Thank so much in
advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to