I am using Visa, Eclipse, Emulator. I can get my position using GPS
using the Emulator.
I want to make my program more battery friendly.

This code never gets to onLocationChanged(). In DDMS I change Lat, and
hit SEND.
I briefly tried the other file-lat-methods, but they didn't do any
better.

Q: If I change the lat by 0.001 (approx 100meters) shouldn't it hit
onLocationChanged() or am I confused...

I got it to work in an entirely different Activity, but this one uses
a thread, so perhaps that's a clue.
Thanks for any help
jim


        @Override
        public void run() {

          Looper.prepare();

          final LocationManager lm=
(LocationManager)getContext().getSystemService(Context.LOCATION_SERVICE);

          final LocationListener locationListener= new
LocationListener() {
              public void onLocationChanged(Location newloc) {
                    Log.d("TAG","NEVER GETS HERE");
              }
              public void onProviderDisabled(String provider) {}
              public void onProviderEnabled(String provider) {}
              public void onStatusChanged(String provider, int status,
                        Bundle extras) {}
          };

          lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
(float) 0.001, locationListener);


          while (true)
          {
             }


        }

Log says:
02-22 09:36:10.598: DEBUG/dalvikvm(338): GC freed 43 objects / 2096
bytes in 75ms
02-22 09:36:13.688: DEBUG/LocationManager(2465): Constructor: service
= android.location.ilocationmanager$stub$pr...@43cf2738
02-22 09:36:15.647: DEBUG/dalvikvm(105): GC freed 3321 objects /
192376 bytes in 118ms
02-22 09:36:21.978: WARN/GpsLocationProvider(55): Duplicate add
listener for uid 10028
02-22 09:36:21.978: DEBUG/GpsLocationProvider(55): setMinTime 0
02-22 09:36:21.978: DEBUG/GpsLocationProvider(55): startNavigating

Then I do DDMS->EmulatorControl-> lon=-120.123 lat=20.0  SEND
Then Log says:
02-22 09:36:31.288: DEBUG/GpsLocationProvider(55): TTFF: 9304




-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to