thanks ip332 and Dan: i have found answer. Listener must be created,beacuse getBestKnownLocation() is just for getting gps immediately,so it is agps,not real gps.
On Wed, Nov 24, 2010 at 4:45 AM, Dan <dan.schm...@gmail.com> wrote: > On Nov 23, 2:28 am, Leon Li <l...@leonstrip.com> wrote: >> hi all: >> i use Location location=manager.getLastKnownLocation("gps") to get >> real gps,but it allways return null,and i walk around outside office >> long time. >> but if i use "network",it work. >> >> dose anyone else know what is wrong? > > Do you have both > > <uses-permission > android:name="android.permission.ACCESS_COARSE_LOCATION"></uses- > permission> > <uses-permission > android:name="android.permission.ACCESS_FINE_LOCATION"></uses- > permission> > > in your manifest? When you started your app did you answer the > dialog saying it's ok to use gps? Is the > > settings->location&security->Use GPS satellites > > checkbox checked on the phone? If all those are true/positive, we > might > need to see more code. > > -- > 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 > -- 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