Thursday, June 30, 2011

[android-developers] Re: AlarmManager - list of alarms set?

Hi Kostya.

This is basically a revival of this old thread, in which you helped me
some time ago.

http://groups.google.com/group/android-developers/browse_thread/thread/b2abad03be3467c0/d73f3780fbdd08f9

In my case, the onReceive method calls an ASyncTask which does some
network calls, so continues on for longer than the life of
onReceive(). I've implemented a Wakelock in my Receiver as you
suggested, which releases the lock once the network task has done its
stuff. However, the process *still* sometimes dies before it gets as
far as releasing the lock. It's definitely better now, just not 100%
reliable.

It's fine on 'good' phones, but on those with lower memory
capabilities (HTC Hero, Samsung Galaxy Europa for example) I still get
this problem. There's no errors, I'm sure of that, it's just being
killed before the task has completed.

On Jun 30, 10:31 am, Kostya Vasilyev <kmans...@gmail.com> wrote:
> There isn't.
>
> You process should not be dying inside an receiver's onReceive, as being
> inside onReceive makes your process least likely to be killed by the
> process killer:
>
> http://developer.android.com/guide/topics/fundamentals/processes-and-...
>
> Perhaps you have a bug where the code crashes or takes too long? AFAIK,
> crashes or ANRs inside receivers are not reported to the user, the
> process is silently killed.
>
> -- Kostya
>
> 30.06.2011 13:14, Neilz пишет:
>
> > Hi all. I'm using AlarmManager to, well, set an alarm which then calls
> > a BroadcastReceiver at specified times.
>
> > Is there a way, in my code, I can get hold of a list of the alarms
> > that have been set, and then identify in some way if my alarm is in
> > the list?
>
> > (I want to do this because sometimes, the process dies in the
> > onReceive() method so the next alarm never gets set, and it would be
> > useful when the app is running to do a double check - and if it's not
> > in the list, then set it again).
>
> > Thanks.
>
> --
> Kostya Vasilyev

--
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