Hi Mark,
Thank you, I've added a Toast to my wprotatorReciever onReceive routine
and it is getting there, here is the code for that onReceive routine:
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "wprotatorReciever",
Toast.LENGTH_SHORT).show();
wpService.sendWakefulWork( context );
}
Although it is getting into the onReceive every 5 seconds, it is not
performing the service...this is the same code that is scheduled when
running normally and it works then but not after a reboot.
Thank you,
Simon
On 11/06/2011 9:23 PM, Mark Murphy wrote:
Try SystemClock.elapsedRealtime()+lngInterval for your second
parameter to setRepeating(). Then add an entry to LogCat using
android.util.Log in wprotatorReciever's onReceive() method to confirm
if you are getting there.
I don't recommend using Toasts from background stuff, alarms and boot
receivers in particular, even for diagnostic stuff. LogCat will be
more safer and less likely to be missed.
On Sat, Jun 11, 2011 at 4:13 PM, Simon Platten
<[email protected]> wrote:
Its been a while since I first posted regarding this problem, I've been
away...Mark Murphy was advising me on the problem and I said I would post
the code:
I can see from the Toast in my class that the onReceive method is being
called, but the actual intent that I install in the AlarmManager doesn't
work.
Here is the onReceive code:
public void onReceive(Context context, Intent intent) {
clsWallpaper.wpSettings settings = clsWallpaper.getSettings( context
);
if ( settings.m_intRotation == clsWallpaper.FREQ_MANUAL ) {
// Do nothing rotation is manual!
return;
}
if ( settings != null ) {
AlarmManager am =
(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(context, wprotatorReciever.class);
PendingIntent sender = PendingIntent.getBroadcast(context, 0, i,
0);
long lngInterval = clsWallpaper.getInterval(
settings.m_intRotation, settings.m_lngInterval );
am.setRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime(),
lngInterval,
sender);
Toast.makeText(context, "Wall-paper: " +
Long.toString(lngInterval), Toast.LENGTH_SHORT).show();
}
}
The toast near the end does come up after a reboot and the interval I've set
is 5 seconds, so it displays 5000 milliseconds.
Thanks for any help...
Simon
--
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
--
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