iPhone sleep

527 views
Skip to first unread message

Michael

unread,
Jan 3, 2011, 7:44:38 AM1/3/11
to phonegap
I'm writing a task timer in HTML/CSS/Javascript and plan to use
phonegap. My timer plays an "bell" sound when a certain amount of
time working on the task has elapsed. However, if the iPhone goes to
sleep while the timer is running, the bell doesn't sound. Is there a
way in phonegap to either (i) stop iPhone going to sleep (I think the
answer to this one is "no") or (ii) programatically waking it from
sleep at a certain time? I presume these things are possible in a
native app written in Objective-C but I want to avoid Objective-C if I
can.

Nick McCloud

unread,
Jan 4, 2011, 5:15:08 PM1/4/11
to phonegap
You could write a plugin to create an alarm event that will be
serviced by iOS.

Giacomo Balli

unread,
Jan 4, 2011, 6:14:12 PM1/4/11
to phonegap
you can disable sleep.

Jesse MacFadyen

unread,
Jan 4, 2011, 6:15:28 PM1/4/11
to Giacomo Balli, phonegap
a 'how' might help ...

you can disable sleep.
--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com



--
--
Jesse MacFadyen
{
  blog:'blogs.nitobi.com/jesse',
  email:'jesse.m...@nitobi.com',
  company:
  {
    name:'Nitobi Software',
    site:'www.nitobi.com',
    phone:
    {
      office:'+1 (604) 685-9287',
      tollFree:'1-866-632-2777'
     }
  }
}

Giacomo Balli

unread,
Jan 4, 2011, 6:20:08 PM1/4/11
to phonegap
didn't want to take the fun out of the search and glory out of the
find... ;)
http://groups.google.com/group/phonegap/browse_thread/thread/5eeace5c416719ec/d7180ef5a3a9081d?lnk=gst&q=lock#d7180ef5a3a9081d

On Jan 5, 12:15 am, Jesse MacFadyen <jesse.macfad...@nitobi.com>
wrote:
> a 'how' might help ...
>
> On Tue, Jan 4, 2011 at 3:14 PM, Giacomo Balli <giacomoba...@gmail.com>wrote:
>
>
>
>
>
> > you can disable sleep.
>
> > On Jan 4, 11:15 pm, Nick McCloud <n...@descartes.co.uk> wrote:
> > > You could write a plugin to create an alarm event that will be
> > > serviced by iOS.
>
> > > On Jan 3, 12:44 pm, Michael <j8dy...@gmail.com> wrote:
>
> > > > I'm writing a task timer in HTML/CSS/Javascript and plan to use
> > > > phonegap.  My timer plays an "bell" sound when a certain amount of
> > > > time working on the task has elapsed.  However, if the iPhone goes to
> > > > sleep while the timer is running, the bell doesn't sound.  Is there a
> > > > way in phonegap to either (i) stop iPhone going to sleep (I think the
> > > > answer to this one is "no") or (ii) programatically waking it from
> > > > sleep at a certain time?  I presume these things are possible in a
> > > > native app written in Objective-C but I want to avoid Objective-C if I
> > > > can.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "phonegap" group.
> > To post to this group, send email to phon...@googlegroups.com
> > To unsubscribe from this group, send email to
> > phonegap+u...@googlegroups.com<phonegap%2Bunsubscribe@googlegroups.c om>
> > For more options, visit this group at
> >http://groups.google.com/group/phonegap?hl=en?hl=en
>
> > For more info on PhoneGap or to download the code go towww.phonegap.com
>
> --
> --
> Jesse MacFadyen
> {
>   blog:'blogs.nitobi.com/jesse',
>   email:'jesse.macfad...@nitobi.com <email%3A%27jesse.macfad...@nitobi.com>

Michael

unread,
Jan 4, 2011, 7:02:48 PM1/4/11
to phonegap
Thanks everyone! That's plenty to keep me going for now. Switching
off sleep seems like the easier option - I might try both ideas out
and See how I get on. It's a relief to know it can be done... I was
worried I was going to have to scrap everything and start learning
Objective-C!

On Jan 4, 11:20 pm, Giacomo Balli <giacomoba...@gmail.com> wrote:
> didn't want to take the fun out of the search and glory out of the
> find... ;)http://groups.google.com/group/phonegap/browse_thread/thread/5eeace5c...
>
> On Jan 5, 12:15 am, Jesse MacFadyen <jesse.macfad...@nitobi.com>
> wrote:
>
>
>
> > a 'how' might help ...
>
> > On Tue, Jan 4, 2011 at 3:14 PM, Giacomo Balli <giacomoba...@gmail.com>wrote:
>
> > > you can disable sleep.
>
> > > On Jan 4, 11:15 pm, Nick McCloud <n...@descartes.co.uk> wrote:
> > > > You could write a plugin to create an alarm event that will be
> > > > serviced by iOS.
>
> > > > On Jan 3, 12:44 pm, Michael <j8dy...@gmail.com> wrote:
>
> > > > > I'm writing a task timer in HTML/CSS/Javascript and plan to use
> > > > > phonegap.  My timer plays an "bell" sound when a certain amount of
> > > > > time working on the task has elapsed.  However, if the iPhone goes to
> > > > > sleep while the timer is running, the bell doesn't sound.  Is there a
> > > > > way in phonegap to either (i) stop iPhone going to sleep (I think the
> > > > > answer to this one is "no") or (ii) programatically waking it from
> > > > > sleep at a certain time?  I presume these things are possible in a
> > > > > native app written in Objective-C but I want to avoid Objective-C if I
> > > > > can.
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "phonegap" group.
> > > To post to this group, send email to phon...@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > phonegap+u...@googlegroups.com<phonegap%2Bunsubscr...@googlegroups.c om>

Nick McCloud

unread,
Jan 5, 2011, 4:21:34 AM1/5/11
to phonegap
If you alarms are too far in to the future you may not have any
battery left to actually do the alert.

This is one of those Apple approval grey areas - you may have to alert
the user that the phone will be kept on and that long period alarms
will result in shorter battery life.
Reply all
Reply to author
Forward
0 new messages