blackberry-webworks / BB10-Webworks-API

An api repository for webworks
6 stars 1 forks source link

As a WebWorks developer, I can subscribe to events that will notify me when my application is paused or resumed #5

Closed kwallis closed 12 years ago

kwallis commented 12 years ago

The developer will want to be able to perform some logic when their application is put into background mode by the system. Same for when the application returns toi execution (i.e. put in foreground).

Acceptance Criteria

  1. These events should be triggered with the same logic as the rest of the system, and obey the system settings for when an application is actually paused and resumed.
  2. This API should mimic the Cordova signature for these events:
    • a callback can be passed into blackberry.event.addEventListener, associated with a "pause" or "suspend" event.
    • eg. blackberry.event.addEventListener("pause", onPause);
  3. all events will fall into the "blackberry.event" feature id, which will be used for whitelisting.
nukulb commented 12 years ago

can you post the exact signatures or a link to the documentation?

kwallis commented 12 years ago

http://docs.phonegap.com/en/1.5.0rc1/phonegap_events_events.md.html#Events

Ken Wallis Product Manager ­ BlackBerry WebWorks

Research In Motion (905) 629-4746 x14369

-----Original Message----- From: Nukul Bhasin <reply+i-3629948-df058a29a603ee70ab0e2ba0fb1c5ce10a6fc50b-498318@reply.gith ub.com> Date: Tue, 13 Mar 2012 13:37:03 -0700 To: Ken Wallis kwallis@rim.com Subject: Re: [BB10-Webworks-API] As a WebWorks developer, I can subscribe to events that will notify me when my application is paused or resumed (#5)

can you post the exact signatures or a link to the documentation?


Reply to this email directly or view it on GitHub: https://github.com/blackberry-webworks/BB10-Webworks-API/issues/5#issuecom ment-4485573


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

efidler commented 12 years ago

page visibility, perhaps? http://www.w3.org/TR/2011/WD-page-visibility-20110602/

nukulb commented 12 years ago

@efidlerrim Are you suggesting we use the page Visibility signature or we implement a webworks api based on this existing webkit event? Is this event available in PB2.0?

efidler commented 12 years ago

it seems like (at least some of) this functionality basically duplicates Page Visibility, so why not use it? We don't have it on PB2.0.

kwallis commented 12 years ago

Does our implementation of page visibility reflect the actual state of the application, and does it respect the different settings the user can

configure for if/when the application execution is actually paused?

Ken Wallis Product Manager ­ BlackBerry WebWorks

Research In Motion (905) 629-4746 x14369

-----Original Message----- From: "Eli Fidler (RIM)" <reply+i-3629948-df058a29a603ee70ab0e2ba0fb1c5ce10a6fc50b-498318@reply.gith ub.com> Date: Tue, 27 Mar 2012 08:57:34 -0700 To: Ken Wallis kwallis@rim.com Subject: Re: [BB10-Webworks-API] As a WebWorks developer, I can subscribe to events that will notify me when my application is paused or resumed (#5)

it seems like (at least some of) this functionality basically duplicates Page Visibility, so why not use it? We don't have it on PB2.0.


Reply to this email directly or view it on GitHub: https://github.com/blackberry-webworks/BB10-Webworks-API/issues/5#issuecom ment-4719712


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

efidler commented 12 years ago

Should do.

Eli

On 3/27/12 12:13 PM, "Ken Wallis" <reply+i-3629948-7a256d2cee264a5ad6db69b89f1e497440d78c8c-415600@reply.gith ub.com> wrote:

Does our implementation of page visibility reflect the actual state of the application, and does it respect the different settings the user can

configure for if/when the application execution is actually paused?

Ken Wallis Product Manager ­ BlackBerry WebWorks

Research In Motion (905) 629-4746 x14369

-----Original Message----- From: "Eli Fidler (RIM)" <reply+i-3629948-df058a29a603ee70ab0e2ba0fb1c5ce10a6fc50b-498318@reply.git h ub.com> Date: Tue, 27 Mar 2012 08:57:34 -0700 To: Ken Wallis kwallis@rim.com Subject: Re: [BB10-Webworks-API] As a WebWorks developer, I can subscribe to events that will notify me when my application is paused or resumed (#5)

it seems like (at least some of) this functionality basically duplicates Page Visibility, so why not use it? We don't have it on PB2.0.


Reply to this email directly or view it on GitHub: https://github.com/blackberry-webworks/BB10-Webworks-API/issues/5#issueco m ment-4719712


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.


Reply to this email directly or view it on GitHub: https://github.com/blackberry-webworks/BB10-Webworks-API/issues/5#issuecom ment-4720125


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

rwmtse commented 12 years ago

@kwallis I am currently working on the implementation. What we do currently is we define a callback that gets invoked by the web launcher whenever the window state is changed. The web launcher calls this callback with 3 possible window states: fullscreen, thumbnail, or invisible. The code would trigger the onPause callback whenever window state == thumbnail, or the onResume callback whenever state == fullscreen.

kwallis commented 12 years ago

This is dependent on the system setting though?

Settings -> General -> Application Behavior.

If you select Showcase or Default, the app would still be running even in thumbnail. For Showcase, it would never be paused at all.

We need these settings to be respected. Does the web launcher, or something below it, respect these settings and only fire the window states under the right circumstances? If not, then window state may not be the

right indicator of the application behavior.

Ken Wallis Product Manager ­ BlackBerry WebWorks

Research In Motion (905) 629-4746 x14369

-----Original Message----- From: Rosa Tse <reply+i-3629948-df058a29a603ee70ab0e2ba0fb1c5ce10a6fc50b-498318@reply.gith ub.com> Date: Tue, 27 Mar 2012 11:42:19 -0700 To: Ken Wallis kwallis@rim.com Subject: Re: [BB10-Webworks-API] As a WebWorks developer, I can subscribe to events that will notify me when my application is paused or resumed (#5)

@kwallis I am currently working on the implementation. What we do currently is we define a callback that gets invoked by the web launcher whenever the window state is changed. The web launcher calls this callback with 3 possible window states: fullscreen, thumbnail, or invisible. The code would trigger the onPause callback whenever window state == thumbnail, or the onResume callback whenever state == fullscreen.


Reply to this email directly or view it on GitHub: https://github.com/blackberry-webworks/BB10-Webworks-API/issues/5#issuecom ment-4723399


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

rwmtse commented 12 years ago

I've tested it. window states aren't tied to Application Behaviour. I would need to find another way to do it.

rwmtse commented 12 years ago

@kwallis I found that WebWorks for PB implemented onForeground/onBackground API based on window state before. I checked the code. It relies on flash.events.Event.activate/deactivate. This is the description for the activate event in Flash documentation: "Dispatched when the Flash Player or AIR application gains operating system focus and becomes active" http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/EventDispatcher.html#event:activate

kwallis commented 12 years ago

This does not necessarily equate to the window state that you outlined before. I think we would need to know what native event/trigger the AIR

code is actually relying on to know if it is what window state is?

Ken Wallis Product Manager ­ BlackBerry WebWorks

Research In Motion (905) 629-4746 x14369

-----Original Message----- From: Rosa Tse <reply+i-3629948-df058a29a603ee70ab0e2ba0fb1c5ce10a6fc50b-498318@reply.gith ub.com> Date: Tue, 27 Mar 2012 13:33:03 -0700 To: Ken Wallis kwallis@rim.com Subject: Re: [BB10-Webworks-API] As a WebWorks developer, I can subscribe to events that will notify me when my application is paused or resumed (#5)

@kwallis I found that WebWorks for PB implemented onForeground/onBackground API based on window state before. I checked the code. It relies on flash.events.Event.activate/deactivate. This is the description for the activate event in Flash documentation: "Dispatched when the Flash Player or AIR application gains operating system focus and becomes active" http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/e vents/EventDispatcher.html#event:activate


Reply to this email directly or view it on GitHub: https://github.com/blackberry-webworks/BB10-Webworks-API/issues/5#issuecom ment-4725710


This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

erhorim commented 12 years ago

Feature implemented by blackberry-webworks/BB10-WebWorks-Framework#16

kwallis commented 12 years ago

Released