[android-developers] Re: Nexus one gps issue

2010-05-12 Thread Namrata
thanks Streets, I will try this solution..

On May 11, 9:08 pm, Streets Of Boston flyingdutc...@gmail.com wrote:
 You probably do NOT want to put the starting and stopping of the
 location (GPS) providers in the onStart() and onStop().

 The onStop() may not be called when your activity goes to the
 background:
  - It is not called because your activity remains active in the
 background
  - It is not called because the OS just killed your entire process.
    (this would actually kill the GPS provider as well).

 Instead, start and stop the GPS provider in the onResume() and
 onPause().

 On May 11, 10:14 am, Namrata puranik.namr...@gmail.com wrote:



  Please anybody knows about it??

  On May 11, 1:42 pm, Namrata puranik.namr...@gmail.com wrote:

   Hi,

   I am working app for nexus one which uses gps. I have placed turning
   on code of gps in onStart() of Activity and and turning off code in
   onStop(). As per logs On/Off works fine specially turning off. But
   then gps icon stays forever on notification bar. Is there any bug/
   issue with Nexus One GPS? or am I doing anything wrong?

   Tunrning on/ off code is as follows

   onStart(){
   ...

   String[] providers = { LocationManager.GPS_PROVIDER,
   LocationManager.NETWORK_PROVIDER };

                           int noOfProviders = providers.length;
                           for (int i = 0; i  noOfProviders; i++) {

                                   final String currentProvider = 
   providers[i];
                                   if 
   (locManager.isProviderEnabled(currentProvider)) {
                                           
   locManager.requestLocationUpdates(currentProvider, 100L, 0.0f,
   _instance);
                                   }
                           }
   ...

   }

   onStop(){
   ...

   if (locManager != null) {
                                   locManager.removeUpdates(_instance);
                           }
   ...

   }

   and the logs for turning off gps are..

   LocationManager(  369): removeUpdates: listener =
   com.xxx.xxx@4495e330

   D/NetworkLocationProvider(   76): removeListener(): com.xxx.xxx

   D/GpsLocationProvider(   76): stopNavigating

   D/libgps  (   76): qct_gps_stop

   Thanks in advance

   Namrata

   --
   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 
   athttp://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 
  athttp://groups.google.com/group/android-developers?hl=en-Hide quoted text -

  - Show quoted text -

 --
 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 
 athttp://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


[android-developers] Re: Nexus one gps issue

2010-05-11 Thread Namrata
Please anybody knows about it??

On May 11, 1:42 pm, Namrata puranik.namr...@gmail.com wrote:
 Hi,

 I am working app for nexus one which uses gps. I have placed turning
 on code of gps in onStart() of Activity and and turning off code in
 onStop(). As per logs On/Off works fine specially turning off. But
 then gps icon stays forever on notification bar. Is there any bug/
 issue with Nexus One GPS? or am I doing anything wrong?

 Tunrning on/ off code is as follows

 onStart(){
 ...

 String[] providers = { LocationManager.GPS_PROVIDER,
 LocationManager.NETWORK_PROVIDER };

                         int noOfProviders = providers.length;
                         for (int i = 0; i  noOfProviders; i++) {

                                 final String currentProvider = providers[i];
                                 if 
 (locManager.isProviderEnabled(currentProvider)) {
                                         
 locManager.requestLocationUpdates(currentProvider, 100L, 0.0f,
 _instance);
                                 }
                         }
 ...

 }

 onStop(){
 ...

 if (locManager != null) {
                                 locManager.removeUpdates(_instance);
                         }
 ...

 }

 and the logs for turning off gps are..

 LocationManager(  369): removeUpdates: listener =
 com.xxx.xxx@4495e330

 D/NetworkLocationProvider(   76): removeListener(): com.xxx.xxx

 D/GpsLocationProvider(   76): stopNavigating

 D/libgps  (   76): qct_gps_stop

 Thanks in advance

 Namrata

 --
 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 
 athttp://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


[android-developers] Re: Nexus one gps issue

2010-05-11 Thread Streets Of Boston
You probably do NOT want to put the starting and stopping of the
location (GPS) providers in the onStart() and onStop().

The onStop() may not be called when your activity goes to the
background:
 - It is not called because your activity remains active in the
background
 - It is not called because the OS just killed your entire process.
   (this would actually kill the GPS provider as well).

Instead, start and stop the GPS provider in the onResume() and
onPause().


On May 11, 10:14 am, Namrata puranik.namr...@gmail.com wrote:
 Please anybody knows about it??

 On May 11, 1:42 pm, Namrata puranik.namr...@gmail.com wrote:





  Hi,

  I am working app for nexus one which uses gps. I have placed turning
  on code of gps in onStart() of Activity and and turning off code in
  onStop(). As per logs On/Off works fine specially turning off. But
  then gps icon stays forever on notification bar. Is there any bug/
  issue with Nexus One GPS? or am I doing anything wrong?

  Tunrning on/ off code is as follows

  onStart(){
  ...

  String[] providers = { LocationManager.GPS_PROVIDER,
  LocationManager.NETWORK_PROVIDER };

                          int noOfProviders = providers.length;
                          for (int i = 0; i  noOfProviders; i++) {

                                  final String currentProvider = providers[i];
                                  if 
  (locManager.isProviderEnabled(currentProvider)) {
                                          
  locManager.requestLocationUpdates(currentProvider, 100L, 0.0f,
  _instance);
                                  }
                          }
  ...

  }

  onStop(){
  ...

  if (locManager != null) {
                                  locManager.removeUpdates(_instance);
                          }
  ...

  }

  and the logs for turning off gps are..

  LocationManager(  369): removeUpdates: listener =
  com.xxx.xxx@4495e330

  D/NetworkLocationProvider(   76): removeListener(): com.xxx.xxx

  D/GpsLocationProvider(   76): stopNavigating

  D/libgps  (   76): qct_gps_stop

  Thanks in advance

  Namrata

  --
  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 
  athttp://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 
 athttp://groups.google.com/group/android-developers?hl=en- Hide quoted text -

 - Show quoted text -

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