switch between GPS and Networkprovider

Put your problem here if it does not fit any of the other categories.

switch between GPS and Networkprovider

Postby mnish » Sat Jul 04, 2009 8:09 pm

Hi,

I wanted to know how to switch beteen GPS and Network providers.

Iam now busy with making a program that shows the location of the
phone holder on the google map. I want to make use of both the GPS
provider and the network provider. I prefer using gps. When gps is not
temporarily unavailable then the program chooses for the network
provider. But when the gps is available again I want the program to
use the gps again.

At this moment my program is only able to switch to network provider
when gps is not available but it cant check whether gps is back again.
here is how it is done:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. @Override
  3.  
  4.         public void onStatusChanged(String provider, int status, Bundle b) {
  5.  
  6.                    if (status == LocationProvider.OUT_OF_SERVICE) {
  7.  
  8.  
  9.  
  10.                                 lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
  11.  
  12. mInterval, 0, this);
  13.  
  14.  
  15.  
  16.                         }
  17.  
  18.  
  19.  
  20.                         else if(status ==  LocationProvider.TEMPORARILY_UNAVAILABLE){
  21.  
  22.  
  23.  
  24.                                 lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
  25.  
  26. mInterval, 0, this);
  27.  
  28.                         }
  29.  
  30.         }
  31.  
  32.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4



Could someone please tell me how to check the status of the gps while
the location manager is using the Network provider?

thank you
mnish
Freshman
Freshman
 
Posts: 3
Joined: Sun Jun 21, 2009 1:57 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 7 guests