I've added

Location loc = new Location(lP.getName());
loc.setLatitude(37.422006);
loc.setLongitude(-122.084095);
lM.setTestProviderLocation(lP.getName(), loc);

but the LocationListener doesnt get called. So I get no location
update.



On 21 Aug., 11:46, code_android_festival_way
<[EMAIL PROTECTED]> wrote:
> Ok. It was a silly question.
>
> Looper.prepare();
>
> added.
>
> But I dont get any LocationUpdates. I have pushed locations to the
> device through the DDMS interface but get no LocationUpdate.
>
> On 21 Aug., 11:40, code_android_festival_way
>
> <[EMAIL PROTECTED]> wrote:
> > Thank you for your reponse. I'm trying to implement the
> > requestUpdates() now. At the moment I'm faced with the follwing
> > problem. I've implemented the LocationListener but always get the
> > following LogCat error.
>
> > Can't create handler inside thread that has not called
> > Looper.prepare()
>
> > Well I'm calling my geo class in a thread that was started by a
> > service. At the moment it looks like this. What do I have to change in
> > order to get the listener working?
>
> > My Geo class:
>
> >http://paste.pocoo.org/show/80ypWR00yHnHRz9pN7mc/
>
> > Regards!
>
> > On 20 Aug., 18:36, Reto <[EMAIL PROTECTED]> wrote:
>
> > > The getLastKnownLocation method will return null until the provider
> > > you specify has gotten at least one update. In practice that means you
> > > need to have an application (any application, doesn't have to be the
> > > one your testing) request (and receive) updates at least once in your
> > > emulator session before it will getLastKnown will return a value.
>
> > > You can disable the updates after the first return if you want to, in
> > > fact that's probably a reasonable way of implementing the
> > > 'getCurrentLocation' functionality you're after.
>
> > > Cheers
> > > Reto
>
> > > On 20 Aug, 14:21, code_android_festival_way
>
> > > <[EMAIL PROTECTED]> wrote:
> > > > Firstly I got the question why I can't get the currentlocationany
> > > > more. I don't need repeating updates of my position I just need the
> > > > currentlocation. At the moment I'm using getLastKnownLocation() but I
> > > > would assume that this position could be very outdated.
>
> > > > Furthermore the method "getLastKnownLocation()" returns me aLocation
> > > > object that is null. Here is the code that I'm using at the moment:
>
> > > > LocationManager lM =
> > > > (LocationManager)context.getSystemService(context.LOCATION_SERVICE);
> > > > LocationProvider lP = lM.getProvider("gps");
> > > >Locationloc = lM.getLastKnownLocation(lP.getName());
> > > > String[]location=
> > > > {String.valueOf(loc.getLongitude()),String.valueOf(loc.getLatitude())};
>
> > > > I've added the following permission to my manifest file:
>
> > > >     <uses-permission
> > > > android:name="android.permission.ACCESS_LOCATION" />
> > > >     <uses-permission
> > > > android:name="android.permission.ACCESS_FINE_LOCATION" />
> > > >     <uses-permission  android:name="android.permission.ACCESS_GPS" />
> > > >     <uses-permission
> > > > android:name="android.permission.ACCESS_MOCK_LOCATION" />
>
> > > > But I'm always getting a Nullpointer Exception using theLocation. (so
> > > > theLocationreturned is null)
>
> > > > Could you give me a hint how I could achieve to get my current/
> > > > lastKnownlocationin 0.9? (in M5 everything was fine)
>
> > > > Looking forward getting your answers.
>
> > > > Regards and happy coding!
>
>
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to