Hi,

I am developing an app which uses GPS to find current location. ASAP I
get location I shut down GPS listener..For some of the phones like
droid, hero on CDMA, it is not getting closed. Following is the code
snipset..

final String currentProvider = LocationManager.GPS_PROVIDER;
                        if(locManager.isProviderEnabled(currentProvider)) {


                                HandlerThread mThread = new HandlerThread("GPS 
Thread");
                                mThread.start();
                                new Handler(mThread.getLooper()).post (
                                        new Runnable() {
                                        public void run() {
                                                
locManager.requestLocationUpdates(currentProvider, 1L, 0.0f,
this);
                                        }
                                });
                                currentLocation =
locManager.getLastKnownLocation(currentProvider);
                                try {
                                        if(currentLocation != null) {

                                        // Do anything with current location.

                                        }
                                } catch (Exception e) {

                                } finally {
                                        try {
                                                if (locManager != null) {
                                                        
locManager.removeUpdates(this);
                                                }
                                                if (mThread != null) {
                                                        
mThread.getLooper().quit();
                                                }

                                        } catch (Exception e) {

                                        }
                                }
                        }

Even though I am calling removeUpdate() it keeps gps icon on
notification bar. What am I doing wrong?

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 at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to