as far as i know u cannot connect to gps usin the emulator... On Thu, May 28, 2009 at 12:39 PM, chen hence <[email protected]> wrote:
> can you send me your full codes? > im on a project on gps. > Thanks for your help. > Hence Chen > > 2009/5/22 pawpaw17 <[email protected]> > >> >> I'm having no luck getting getLastKnownLocation to >> return a non-null value in the Android emulator running >> in Eclipse. The following call always returns null: >> >> locationManager.getLastKnownLocation(bestProvider); >> >> (bestprovider is "gps") >> >> In the intent's onCreate method I spawn a thread that calls >> requestFirstUpdate(). >> The onLocationChanged method fires so I presume the location was >> updated (I use the >> location section of the DDMS to push out a location first). >> >> private void requestFirstUpdate(){ >> >> LocationListener myLocationListener = new LocationListener(){ >> public void onLocationChanged(Location location){ >> locationManager.removeUpdates(this); >> } >> >> public void onProviderDisabled(String provider){ >> locationManager.removeUpdates(this); >> provisionProvider(); >> } >> >> public void onStatusChanged(String provider, int status, Bundle >> extras) >> { >> locationManager.removeUpdates(this); >> provisionProvider(); >> } >> public void onProviderEnabled(String arg0) { >> locationManager.removeUpdates(this); >> } >> }; >> locationManager.requestLocationUpdates(bestProvider, 0, 0, >> myLocationListener); >> >> } >> >> In my manifest I have these lines: >> >> <uses-permission android:name="android.permission.INTERNET"/> >> <uses-permission >> android:name="android.permission.ACCESS_COARSE_LOCATION"/> >> <uses-permission >> android:name="android.permission.ACCESS_FINE_LOCATION"/> >> >> Any ideas? Am I using the emulator incorrectly? >> >> Thanks! >> >> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

