Thanks hackbod, that worked great.

One more question though: I'm acquiring my wakelock in an activity, as
well as attempting to release it in the OnDestroy() function of the
activity itself. Is there a good way to destroy the activity
programmatically? It doesn't appear to be done automatically from what
I could tell, unless I use Process.Kill();.

Thanks again!

On Nov 11, 2:38 pm, hackbod <[EMAIL PROTECTED]> wrote:
> Yes, for both these things, you need to hold a partial wake lock to
> keep the phone from turning off.
>
> On Nov 11, 12:02 pm, g1bb <[EMAIL PROTECTED]> wrote:
>
>
>
> > Maybe PARTIAL_WAKE_LOCK, looking at it now... interesting.
>
> > On Nov 11, 10:45 am, g1bb <[EMAIL PROTECTED]> wrote:
>
> > > Another question on this:
>
> > > Have you seen the Stopwatch application developed by Tom Taylor? I
> > > just downloaded it, and it keeps counting after the phone is put to
> > > sleep entirely. Any ideas on how he's doing that? I'm looking for that
> > > kind of functionality.
>
> > > Thanks again.
>
> > > On Nov 11, 3:51 am, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > > It does wake it up, but you are going to need to hold a wake lock to
> > > > keep the device awake after your intent receiver returns.
>
> > > > On Nov 10, 11:14 pm,g1bb<[EMAIL PROTECTED]> wrote:
>
> > > > > Hello,
>
> > > > > I've been trying to use AlarmManager.RTC_WAKEUP to wake up my device
> > > > > while it's sleeping, and then play some sounds. It seems like when
> > > > > it's charging, this works fine, but when it's not, the service doesn't
> > > > > start until I hit the menu button and am presented with the lock
> > > > > screen.
>
> > > > > Also, this seems to be working fine in the emulator, but not my real
> > > > > phone.
>
> > > > > Here's the alarm scheduling:
> > > > >                   ntent intent = new Intent(Main.this, 
> > > > > OneShotAlarm.class);
> > > > >                   PendingIntent sender =
> > > > > PendingIntent.getBroadcast(Main.this, 0, intent, 0);
>
> > > > >                     // We want the alarm to go off 30 seconds from 
> > > > > now.
> > > > >                     Calendar calendar = Calendar.getInstance();
> > > > >                     
> > > > > calendar.setTimeInMillis(System.currentTimeMillis());
> > > > >                     calendar.add(Calendar.SECOND, 60);
>
> > > > >                     // Schedule the alarm!
> > > > >                     AlarmManager am =
> > > > > (AlarmManager)getSystemService(ALARM_SERVICE);
> > > > >                     am.set(AlarmManager.RTC_WAKEUP,
> > > > > calendar.getTimeInMillis(), sender);
> > > > > ---------------------------------
> > > > > The OneShotAlarm BroadCastReceiver:
>
> > > > > public class OneShotAlarm extends BroadcastReceiver
> > > > > {
>
> > > > >     @Override
> > > > >     public void onReceive(Context context, Intent intent)
> > > > >     {
> > > > >         Toast.makeText(context, "OneShotAlarm Broadcast invoked",
> > > > > 1000).show();
>
> > > > >           intent = new Intent(context, ServiceClassToRun.class);
>
> > > > >          context.startService(intent);
> > > > >      }
> > > > > ---------------------------------
> > > > > The Service:
>
> > > > > public class ServiceClassToRun extends Service {
> > > > >         protected static final int Rnd = 0;
>
> > > > >          public void onStart(Intent intent, int startId) {
> > > > >          //do some business here
> > > > >      }
> > > > > ---------------------------------
> > > > > And finally, my manifest:
>
> > > > >  <receiver android:name=".OneShotAlarm" android:process=":remote" />
> > > > >  <service android:name=".ServiceClassToRun "/>
>
> > > > > Any ideas are greatly appreciated. Has anyone else experienced this as
> > > > > well? Thanks in advance.- Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to