You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Michal Mocny <mm...@google.com> on 2012/10/26 17:29:17 UTC

[ios] Evaluating JS during onAppWillResignActive

Local Notifications, especially on ios, are most useful when app is in
the background.  It would be handy to be able to schedule them during
the window of time allotted during onAppWillResignActive.

We even already have handlers for js document events 'resign' and
'pause' (this one is for a
onAppDidEnterBackground event).  (There are some issues with the
javascript here, seems the events aren't properly defined, will file
separately).

However, no matter how I try, I cannot get more then a trivial amount
of js to execute during the time window before app pauses -- far less
than the allowed 5 seconds.

According to the only (unreliable) source I've found on the subject,
its simply not possible to use the webview during
onAppWillResignActive:
http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event

Does anyone have a better answer here?

Thanks,
-Michal

Re: [ios] Evaluating JS during onAppWillResignActive

Posted by Michal Mocny <mm...@chromium.org>.
Alright, this has been resolved.

See https://issues.apache.org/jira/browse/CB-1746 for my comment about
how this was done (ended up a small change) and what is left to be
done (maybe).

On Mon, Oct 29, 2012 at 11:32 PM, Michal Mocny <mm...@chromium.org> wrote:
> Yes, and I forgot I filed that already, so thanks  ;)
>
> I'll put up the patch tomorrow.  Its still limited what you can do,
> nothing async that uses setTimeout etc, but its nice to be able to use
> console log and so make certain plugin calls, such as notifications.
>
> On Mon, Oct 29, 2012 at 7:22 PM, Shazron <sh...@gmail.com> wrote:
>> Great Michal!
>> I assume it's related to this: https://issues.apache.org/jira/browse/CB-1746
>> Since its a blocker I assume we want to make this in before releasing 2.2.0.
>>
>> On Mon, Oct 29, 2012 at 12:21 PM, Michal Mocny <mm...@chromium.org> wrote:
>>> Success!
>>>
>>> After some debugging with Andrew, we have been able to make the exec
>>> bridge work even in resign event.  (Testing pause event, too).
>>>
>>> I've uncovered a few bugs in the process and patches will be up soon,
>>> but long story short, I've got local notifications being scheduled on
>>> app resign, huzzah!
>>>
>>> On Sat, Oct 27, 2012 at 4:36 PM, Michal Mocny <mm...@chromium.org> wrote:
>>>> Thanks for the link, Shaz.
>>>>
>>>> On Fri, Oct 26, 2012 at 10:40 PM, Shazron <sh...@gmail.com> wrote:
>>>>> This is something we encountered when playing with the pause and
>>>>> resume events. More details in the iOS Quirks of
>>>>> http://docs.phonegap.com/en/2.1.0/cordova_events_events.md.html#pause
>>>>>
>>>>> On Fri, Oct 26, 2012 at 8:29 AM, Michal Mocny <mm...@google.com> wrote:
>>>>>> Local Notifications, especially on ios, are most useful when app is in
>>>>>> the background.  It would be handy to be able to schedule them during
>>>>>> the window of time allotted during onAppWillResignActive.
>>>>>>
>>>>>> We even already have handlers for js document events 'resign' and
>>>>>> 'pause' (this one is for a
>>>>>> onAppDidEnterBackground event).  (There are some issues with the
>>>>>> javascript here, seems the events aren't properly defined, will file
>>>>>> separately).
>>>>>>
>>>>>> However, no matter how I try, I cannot get more then a trivial amount
>>>>>> of js to execute during the time window before app pauses -- far less
>>>>>> than the allowed 5 seconds.
>>>>>>
>>>>>> According to the only (unreliable) source I've found on the subject,
>>>>>> its simply not possible to use the webview during
>>>>>> onAppWillResignActive:
>>>>>> http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event
>>>>>>
>>>>>> Does anyone have a better answer here?
>>>>>>
>>>>>> Thanks,
>>>>>> -Michal

Re: [ios] Evaluating JS during onAppWillResignActive

Posted by Michal Mocny <mm...@chromium.org>.
Yes, and I forgot I filed that already, so thanks  ;)

I'll put up the patch tomorrow.  Its still limited what you can do,
nothing async that uses setTimeout etc, but its nice to be able to use
console log and so make certain plugin calls, such as notifications.

On Mon, Oct 29, 2012 at 7:22 PM, Shazron <sh...@gmail.com> wrote:
> Great Michal!
> I assume it's related to this: https://issues.apache.org/jira/browse/CB-1746
> Since its a blocker I assume we want to make this in before releasing 2.2.0.
>
> On Mon, Oct 29, 2012 at 12:21 PM, Michal Mocny <mm...@chromium.org> wrote:
>> Success!
>>
>> After some debugging with Andrew, we have been able to make the exec
>> bridge work even in resign event.  (Testing pause event, too).
>>
>> I've uncovered a few bugs in the process and patches will be up soon,
>> but long story short, I've got local notifications being scheduled on
>> app resign, huzzah!
>>
>> On Sat, Oct 27, 2012 at 4:36 PM, Michal Mocny <mm...@chromium.org> wrote:
>>> Thanks for the link, Shaz.
>>>
>>> On Fri, Oct 26, 2012 at 10:40 PM, Shazron <sh...@gmail.com> wrote:
>>>> This is something we encountered when playing with the pause and
>>>> resume events. More details in the iOS Quirks of
>>>> http://docs.phonegap.com/en/2.1.0/cordova_events_events.md.html#pause
>>>>
>>>> On Fri, Oct 26, 2012 at 8:29 AM, Michal Mocny <mm...@google.com> wrote:
>>>>> Local Notifications, especially on ios, are most useful when app is in
>>>>> the background.  It would be handy to be able to schedule them during
>>>>> the window of time allotted during onAppWillResignActive.
>>>>>
>>>>> We even already have handlers for js document events 'resign' and
>>>>> 'pause' (this one is for a
>>>>> onAppDidEnterBackground event).  (There are some issues with the
>>>>> javascript here, seems the events aren't properly defined, will file
>>>>> separately).
>>>>>
>>>>> However, no matter how I try, I cannot get more then a trivial amount
>>>>> of js to execute during the time window before app pauses -- far less
>>>>> than the allowed 5 seconds.
>>>>>
>>>>> According to the only (unreliable) source I've found on the subject,
>>>>> its simply not possible to use the webview during
>>>>> onAppWillResignActive:
>>>>> http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event
>>>>>
>>>>> Does anyone have a better answer here?
>>>>>
>>>>> Thanks,
>>>>> -Michal

Re: [ios] Evaluating JS during onAppWillResignActive

Posted by Shazron <sh...@gmail.com>.
Great Michal!
I assume it's related to this: https://issues.apache.org/jira/browse/CB-1746
Since its a blocker I assume we want to make this in before releasing 2.2.0.

On Mon, Oct 29, 2012 at 12:21 PM, Michal Mocny <mm...@chromium.org> wrote:
> Success!
>
> After some debugging with Andrew, we have been able to make the exec
> bridge work even in resign event.  (Testing pause event, too).
>
> I've uncovered a few bugs in the process and patches will be up soon,
> but long story short, I've got local notifications being scheduled on
> app resign, huzzah!
>
> On Sat, Oct 27, 2012 at 4:36 PM, Michal Mocny <mm...@chromium.org> wrote:
>> Thanks for the link, Shaz.
>>
>> On Fri, Oct 26, 2012 at 10:40 PM, Shazron <sh...@gmail.com> wrote:
>>> This is something we encountered when playing with the pause and
>>> resume events. More details in the iOS Quirks of
>>> http://docs.phonegap.com/en/2.1.0/cordova_events_events.md.html#pause
>>>
>>> On Fri, Oct 26, 2012 at 8:29 AM, Michal Mocny <mm...@google.com> wrote:
>>>> Local Notifications, especially on ios, are most useful when app is in
>>>> the background.  It would be handy to be able to schedule them during
>>>> the window of time allotted during onAppWillResignActive.
>>>>
>>>> We even already have handlers for js document events 'resign' and
>>>> 'pause' (this one is for a
>>>> onAppDidEnterBackground event).  (There are some issues with the
>>>> javascript here, seems the events aren't properly defined, will file
>>>> separately).
>>>>
>>>> However, no matter how I try, I cannot get more then a trivial amount
>>>> of js to execute during the time window before app pauses -- far less
>>>> than the allowed 5 seconds.
>>>>
>>>> According to the only (unreliable) source I've found on the subject,
>>>> its simply not possible to use the webview during
>>>> onAppWillResignActive:
>>>> http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event
>>>>
>>>> Does anyone have a better answer here?
>>>>
>>>> Thanks,
>>>> -Michal

Re: [ios] Evaluating JS during onAppWillResignActive

Posted by Dave Johnson <da...@gmail.com>.
sick!

On Mon, Oct 29, 2012 at 8:32 PM, Kerri Shotts <ke...@gmail.com> wrote:
> Fantastic!
>
> _________________________________________~Kerri Shotts, photo (http://www.photokandy.com/)Kandy (http://www.photokandy.com/) Studios LLC (http://www.photokandy.com/)
>    Wanna be our neighbor? Our Facebook page (http://www.facebook.com/pages/photoKandy-Studios/87979941601) & Twitter feed (http://www.twitter.com/photokandy).
>
>
> On Monday, October 29, 2012 at 2:21 PM, Michal Mocny wrote:
>
>> Success!
>>
>> After some debugging with Andrew, we have been able to make the exec
>> bridge work even in resign event. (Testing pause event, too).
>>
>> I've uncovered a few bugs in the process and patches will be up soon,
>> but long story short, I've got local notifications being scheduled on
>> app resign, huzzah!
>>
>> On Sat, Oct 27, 2012 at 4:36 PM, Michal Mocny <mmocny@chromium.org (mailto:mmocny@chromium.org)> wrote:
>> > Thanks for the link, Shaz.
>> >
>> > On Fri, Oct 26, 2012 at 10:40 PM, Shazron <shazron@gmail.com (mailto:shazron@gmail.com)> wrote:
>> > > This is something we encountered when playing with the pause and
>> > > resume events. More details in the iOS Quirks of
>> > > http://docs.phonegap.com/en/2.1.0/cordova_events_events.md.html#pause
>> > >
>> > > On Fri, Oct 26, 2012 at 8:29 AM, Michal Mocny <mmocny@google.com (mailto:mmocny@google.com)> wrote:
>> > > > Local Notifications, especially on ios, are most useful when app is in
>> > > > the background. It would be handy to be able to schedule them during
>> > > > the window of time allotted during onAppWillResignActive.
>> > > >
>> > > > We even already have handlers for js document events 'resign' and
>> > > > 'pause' (this one is for a
>> > > > onAppDidEnterBackground event). (There are some issues with the
>> > > > javascript here, seems the events aren't properly defined, will file
>> > > > separately).
>> > > >
>> > > > However, no matter how I try, I cannot get more then a trivial amount
>> > > > of js to execute during the time window before app pauses -- far less
>> > > > than the allowed 5 seconds.
>> > > >
>> > > > According to the only (unreliable) source I've found on the subject,
>> > > > its simply not possible to use the webview during
>> > > > onAppWillResignActive:
>> > > > http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event
>> > > >
>> > > > Does anyone have a better answer here?
>> > > >
>> > > > Thanks,
>> > > > -Michal
>> > > >
>> > >
>> > >
>> >
>> >
>>
>>
>>
>
>

Re: [ios] Evaluating JS during onAppWillResignActive

Posted by Kerri Shotts <ke...@gmail.com>.
Fantastic! 

_________________________________________~Kerri Shotts, photo (http://www.photokandy.com/)Kandy (http://www.photokandy.com/) Studios LLC (http://www.photokandy.com/)
   Wanna be our neighbor? Our Facebook page (http://www.facebook.com/pages/photoKandy-Studios/87979941601) & Twitter feed (http://www.twitter.com/photokandy).


On Monday, October 29, 2012 at 2:21 PM, Michal Mocny wrote:

> Success!
> 
> After some debugging with Andrew, we have been able to make the exec
> bridge work even in resign event. (Testing pause event, too).
> 
> I've uncovered a few bugs in the process and patches will be up soon,
> but long story short, I've got local notifications being scheduled on
> app resign, huzzah!
> 
> On Sat, Oct 27, 2012 at 4:36 PM, Michal Mocny <mmocny@chromium.org (mailto:mmocny@chromium.org)> wrote:
> > Thanks for the link, Shaz.
> > 
> > On Fri, Oct 26, 2012 at 10:40 PM, Shazron <shazron@gmail.com (mailto:shazron@gmail.com)> wrote:
> > > This is something we encountered when playing with the pause and
> > > resume events. More details in the iOS Quirks of
> > > http://docs.phonegap.com/en/2.1.0/cordova_events_events.md.html#pause
> > > 
> > > On Fri, Oct 26, 2012 at 8:29 AM, Michal Mocny <mmocny@google.com (mailto:mmocny@google.com)> wrote:
> > > > Local Notifications, especially on ios, are most useful when app is in
> > > > the background. It would be handy to be able to schedule them during
> > > > the window of time allotted during onAppWillResignActive.
> > > > 
> > > > We even already have handlers for js document events 'resign' and
> > > > 'pause' (this one is for a
> > > > onAppDidEnterBackground event). (There are some issues with the
> > > > javascript here, seems the events aren't properly defined, will file
> > > > separately).
> > > > 
> > > > However, no matter how I try, I cannot get more then a trivial amount
> > > > of js to execute during the time window before app pauses -- far less
> > > > than the allowed 5 seconds.
> > > > 
> > > > According to the only (unreliable) source I've found on the subject,
> > > > its simply not possible to use the webview during
> > > > onAppWillResignActive:
> > > > http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event
> > > > 
> > > > Does anyone have a better answer here?
> > > > 
> > > > Thanks,
> > > > -Michal
> > > > 
> > > 
> > > 
> > 
> > 
> 
> 
> 



Re: [ios] Evaluating JS during onAppWillResignActive

Posted by Michal Mocny <mm...@chromium.org>.
Success!

After some debugging with Andrew, we have been able to make the exec
bridge work even in resign event.  (Testing pause event, too).

I've uncovered a few bugs in the process and patches will be up soon,
but long story short, I've got local notifications being scheduled on
app resign, huzzah!

On Sat, Oct 27, 2012 at 4:36 PM, Michal Mocny <mm...@chromium.org> wrote:
> Thanks for the link, Shaz.
>
> On Fri, Oct 26, 2012 at 10:40 PM, Shazron <sh...@gmail.com> wrote:
>> This is something we encountered when playing with the pause and
>> resume events. More details in the iOS Quirks of
>> http://docs.phonegap.com/en/2.1.0/cordova_events_events.md.html#pause
>>
>> On Fri, Oct 26, 2012 at 8:29 AM, Michal Mocny <mm...@google.com> wrote:
>>> Local Notifications, especially on ios, are most useful when app is in
>>> the background.  It would be handy to be able to schedule them during
>>> the window of time allotted during onAppWillResignActive.
>>>
>>> We even already have handlers for js document events 'resign' and
>>> 'pause' (this one is for a
>>> onAppDidEnterBackground event).  (There are some issues with the
>>> javascript here, seems the events aren't properly defined, will file
>>> separately).
>>>
>>> However, no matter how I try, I cannot get more then a trivial amount
>>> of js to execute during the time window before app pauses -- far less
>>> than the allowed 5 seconds.
>>>
>>> According to the only (unreliable) source I've found on the subject,
>>> its simply not possible to use the webview during
>>> onAppWillResignActive:
>>> http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event
>>>
>>> Does anyone have a better answer here?
>>>
>>> Thanks,
>>> -Michal

Re: [ios] Evaluating JS during onAppWillResignActive

Posted by Michal Mocny <mm...@chromium.org>.
Thanks for the link, Shaz.

On Fri, Oct 26, 2012 at 10:40 PM, Shazron <sh...@gmail.com> wrote:
> This is something we encountered when playing with the pause and
> resume events. More details in the iOS Quirks of
> http://docs.phonegap.com/en/2.1.0/cordova_events_events.md.html#pause
>
> On Fri, Oct 26, 2012 at 8:29 AM, Michal Mocny <mm...@google.com> wrote:
>> Local Notifications, especially on ios, are most useful when app is in
>> the background.  It would be handy to be able to schedule them during
>> the window of time allotted during onAppWillResignActive.
>>
>> We even already have handlers for js document events 'resign' and
>> 'pause' (this one is for a
>> onAppDidEnterBackground event).  (There are some issues with the
>> javascript here, seems the events aren't properly defined, will file
>> separately).
>>
>> However, no matter how I try, I cannot get more then a trivial amount
>> of js to execute during the time window before app pauses -- far less
>> than the allowed 5 seconds.
>>
>> According to the only (unreliable) source I've found on the subject,
>> its simply not possible to use the webview during
>> onAppWillResignActive:
>> http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event
>>
>> Does anyone have a better answer here?
>>
>> Thanks,
>> -Michal

Re: [ios] Evaluating JS during onAppWillResignActive

Posted by Shazron <sh...@gmail.com>.
This is something we encountered when playing with the pause and
resume events. More details in the iOS Quirks of
http://docs.phonegap.com/en/2.1.0/cordova_events_events.md.html#pause

On Fri, Oct 26, 2012 at 8:29 AM, Michal Mocny <mm...@google.com> wrote:
> Local Notifications, especially on ios, are most useful when app is in
> the background.  It would be handy to be able to schedule them during
> the window of time allotted during onAppWillResignActive.
>
> We even already have handlers for js document events 'resign' and
> 'pause' (this one is for a
> onAppDidEnterBackground event).  (There are some issues with the
> javascript here, seems the events aren't properly defined, will file
> separately).
>
> However, no matter how I try, I cannot get more then a trivial amount
> of js to execute during the time window before app pauses -- far less
> than the allowed 5 seconds.
>
> According to the only (unreliable) source I've found on the subject,
> its simply not possible to use the webview during
> onAppWillResignActive:
> http://stackoverflow.com/questions/4865742/iphone-webview-onbackground-event
>
> Does anyone have a better answer here?
>
> Thanks,
> -Michal