RE: [android-developers] Re: Please Help with GPS Provider Switch

2011-11-21 Thread Tommy Hartz
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();


  }
}, 3);

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();
  }
  
}, 3);
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


RE: [android-developers] Re: Please Help with GPS Provider Switch

2011-11-21 Thread Tommy Hartz
Good call I guess I could do all three at once then check to see which is
more accurate. startNetwork does get called which is why its so why it is so
weird. I though maybe I was doing some wrong. I'll give it a shot with all 3
and see what happens. Thanks for your time and input!

-Original Message-
From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of gjs
Sent: Monday, November 21, 2011 9:22 PM
To: Android Developers
Subject: [android-developers] Re: Please Help with GPS Provider Switch

Hi,

Yes I understand what you are attempting, I was just suggesting doing all
three at the same time in parallel , that way you'd have a results in 30
seconds or less  not have to wait for up 90 seconds.

And no I don't know why your network provider is no working, try adding some
debug statement to see if startNetwork() is being called ok. Other
suggestion is to use getLastKnownLocation(String).

Regards

On Nov 22, 5:00 am, Tommy Hartz droi...@gmail.com wrote:
 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();

                   }
             }, 3);

             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();
                   }

             }, 3);
             Looper.prepare();
             Looper.myLooper().quit();

 locationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDE
 R, 0, 0, locationListener);

 private void startNetwork(){
             locationManager.removeUpdates(locationListener);
             currentTimer = Network;
             Looper.prepare();
             Looper.myLooper().quit();

 locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDE
 R, 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

-- 
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


RE: [android-developers] Re: Please Help with GPS Provider Switch

2011-11-20 Thread Tommy Hartz
The timer is there to only allow it to check for 30 seconds. Once the 30
seconds are up if it hasn't got a location it cancels the GPS and tries the
Passive, after 30 seconds it stops the passive and goes to network. The
problem is once it gets to the network nothing happens.

 

From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of Deepu George Jacob
Sent: Saturday, November 19, 2011 11:07 AM
To: android-developers@googlegroups.com
Subject: Re: [android-developers] Re: Please Help with GPS Provider Switch

 

GPS never use timer it will automatically update At first check your is
GPS enabled..It also done by programatically ... To check the location
changed by using location.getSpeed(); location.getLatitude() some thing like
that 

-- 
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

-- 
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

Re: [android-developers] Re: Please Help with GPS Provider Switch

2011-11-19 Thread Deepu George Jacob
GPS never use timer it will automatically update At first check your is
GPS enabled..It also done by programatically ... To check the location
changed by using location.getSpeed(); location.getLatitude() some thing
like that

-- 
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

RE: [android-developers] Re: Please Help with GPS Provider Switch

2011-11-18 Thread Tommy Hartz
Thanks for the link, but it doesn't really explain why the network provider
isn't kicking in after trying the GPS and Passive providers.

-Original Message-
From: android-developers@googlegroups.com
[mailto:android-developers@googlegroups.com] On Behalf Of BelvCompSvs
Sent: Thursday, November 17, 2011 11:50 PM
To: Android Developers
Subject: [android-developers] Re: Please Help with GPS Provider Switch

http://www.youtube.com/watch?v=twmuBbC_oB8feature=player_embedded

On Nov 16, 11:24 am, Tommy Hartz droi...@gmail.com wrote:
 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();

                   }

             }, 3);

             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();

                   }

             }, 3);

             Looper.prepare();

             Looper.myLooper().quit();

 locationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDE
 R, 0, 0, locationListener);

 private void startNetwork(){

             locationManager.removeUpdates(locationListener);

             currentTimer = Network;

             Looper.prepare();

             Looper.myLooper().quit();

 locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDE
 R, 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

-- 
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