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 <simonaplat...@googlemail.com> 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 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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