Sunday, December 20, 2009

[android-developers] Re: ($25 reward) GPS not triggering onLocationChanged

I'll try the time zone problem.

The reason I used your WakefulIntentService was just to make sure the
application stays awake, I'm going to remove this now as it is working
just as well as a regular service. This service is started from
another service, which was triggered by an alarm. In regards to you
underground issue, it's a not a problem. The service that starts this
service will call the stopSelf method after 20 seconds, which is more
than the 13 seconds it waits for a location.


On Dec 20, 7:42 am, Mark Murphy <mmur...@commonsware.com> wrote:
> dapaintballer331 wrote:
> > If somebody can get this to work for me, using an emulator on the 1.5
> > sdk, I will send them $25 via paypal if you need it. I am using the
> > android 1.5 emulator.
>
> > Problem: I see the satilite icon on the top of the phone, but when I
> > send the device multiple coordinates, is never runs the
> > onLocationChange method.
>
> I don't think requestLocationUpdates() will work reliably from an
> IntentService. The, um, intent of an IntentService is for it to shut
> down (via stopSelf()) after it has exhausted its queue of work.
>
> Also, I don't see where an IntentService will be called with onStop().
> You might want to slap an @Override on there to confirm. If it does not
> exist, as I suspect, then you will never release your location listener,
> and that is seriously bad with an IntentService.
>
> My guess is that you're trying to create a scheduled task, triggered by
> an alarm, that will look up the current location and do something with
> it. While the IntentService (Wakeful or otherwise) is normally a fine
> answer, I suspect that it will give you loads of problems in this case,
> since it automatically stops when the Intent is delivered and consumed.
> You will probably need to fall back to a regular service, calling
> stopSelf() after you have gotten your location fix, and using a WakeLock
> to keep yourself awake in the interim. Even then, things could get a bit
> icky (e.g., what if the user is underground and you never get a fix?).
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android 1.6 Programming Books:http://commonsware.com/books

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate