Please check the email from John Mellor on the SysApps mailing list.
It shows what Google are thinking about background notifications

Kenneth

On Thu, Dec 26, 2013 at 7:51 AM, Wang, Shiliu <shiliu.w...@intel.com> wrote:
> Yes, you are right. When web app’s activity is paused, currently the js
> timer is stopped, which makes it not able to send out notification. From use
> case perspective, notification is very closely related to app life cycle,
> especially background page(service like) support. But the implementation is
> independent however.
>
>
>
> Thanks,
>
> Shiliu.
>
>
>
> From: Zhu, Yongsheng
> Sent: Wednesday, December 25, 2013 4:01 PM
> To: Min, Hongbo; Wang, Shiliu; 'crosswalk-dev@lists.crosswalk-project.org'
> Cc: Christiansen, Kenneth R
> Subject: RE: Intent to implement - [Android] Standard Web notification API
> for xwalk.
>
>
>
> Thanks, Shiliu and Hongbo.
>
> The most important use case is that web apps can send notification messages
> after it’s in background. It’s a very common case, I think.
>
> Currently if a web app is paused, it seems it may not do anything including
> sending notification messages?  This is what we need to consider together
> with app life cycle.
>
>
>
> Yongsheng
>
>
>
> From: Crosswalk-dev
> [mailto:crosswalk-dev-boun...@lists.crosswalk-project.org] On Behalf Of Min,
> Hongbo
> Sent: Wednesday, December 25, 2013 10:34 AM
> To: Wang, Shiliu; 'crosswalk-dev@lists.crosswalk-project.org'
> Cc: Christiansen, Kenneth R
> Subject: Re: [Crosswalk-dev] Intent to implement - [Android] Standard Web
> notification API for xwalk.
>
>
>
> A very elaborate write-up!
>
>
>
> The notification would not be fired if the web app is in background, e.g.
> after home button is pressed, right? I assume yes since once the app is
> switched to background, it is in paused status.
>
>
>
> From: Crosswalk-dev
> [mailto:crosswalk-dev-boun...@lists.crosswalk-project.org] On Behalf Of
> Wang, Shiliu
> Sent: Tuesday, December 24, 2013 2:04 PM
> To: 'crosswalk-dev@lists.crosswalk-project.org'
> Cc: Christiansen, Kenneth R
> Subject: [Crosswalk-dev] Intent to implement - [Android] Standard Web
> notification API for xwalk.
>
>
>
> Description:
>
> Web notification api is missed in xwalk. The spec is defined at
> http://www.w3.org/TR/notifications/ . It’s for web app to be able to create
> an OS level notification, which will bring the app back to front when being
> clicked.
>
> On Android, system notifications are the ones listed when pulling down the
> status bar. Chromium support both standard web notification and web
> notification with customized html layout. For xwalk on Android, will only
> implement standard web notification for first step.
>
>
>
> Affected component:
>
> 1.       XWalk Runtime, for overwriting interface from content.
>
> 2.       Android port, for implementing the notification.
>
>
>
> Related feature: (JIRA ID):
>
> https://crosswalk-project.org/jira/browse/XWALK-94
>
>
>
> Target Release: (Crosswalk N):
>
> Crosswalk 4
>
>
>
> Implementation details:
>
> 1.       Content already exposes interface for web notification from blink.
> ContentBrowserClient for blink to browser(handling request for create/show
> notification) and RenderViewHost for browser to blink(trigger js callback
> when notification clicked/closed/shown).
>
> 2.       The UI composition of web notification and android notification is
> quite match, they both contain title, message and icon. So the properties of
> web notification will be directly mapped to the relevant field for android
> notification.
>
> 3.       Icon is a little bit more complicated, android notification accept
> a small icon and a big one, small icon will be used when the status bar is
> not expanded. And it must be a resource id, while big icon can be a bitmap.
> For web notification, icon is normally a url. So the small icon for android
> notification will be set to the application’s icon regardless of the url
> specified in web notification.
>
> 4.       For browser, web notification requires an explicit grant of
> permission. For webapp, it will be granted by default if the permission is
> declared in manifest.
>
> 5.       Notification won’t be gone even the application is closed or killed
> by android.
>
> 6.       For android, the notification can carry two Pending Intent, one for
> clicked and the other for canceled.
>
> a.       Clicking notification:
>
>                                                                i.      If
> webapp is still alive, bring the app to front and invoke the onclick js
> callback.
>
>                                                              ii.      If
> webapp is gone, recreate the webapp. It’s impossible to invoke the js
> callback in this case.
>
> b.      Canceling notification:
>
>                                                                i.      If
> webapp is still alive, invoke the onclose js callback. (the callback will be
> executed after the webapp brought back to front, because when it’s stopped,
> js timer is stopped.)
>
>                                                              ii.      If
> webapp is gone, nothing else will happen.
>
> 7.       To achieve above,
>
> a.       The pending intent for clicking will be an activity intent with
> flag LAUNCH_FROM_HISTORY. For bring the app back to front, this is enough.
> To invoke the js callback, the embedder activity(including
> xwalkRuntimeActivityBase for runtime usage, CoreShellActivity,
> CordovaActivity) needs to override the onNewIntent() function and send the
> new intent to XWalkContentClientBridge, bridge will handle the new intent
> and invoke the correct callback through notification id.
>
> b.      The pending intent for closing will be a broadcast intent. The
> broadcast receiver will be registered/unregistered dynamically regarding to
> the creation/deletion of web notification. When the webapp is killed, the
> broadcast receiver is gone too. It’s to avoid starting any process when
> cancelling notification.
>
> 8.       Android only keeps one PendingIntent for each kind system wide. The
> “kind” is determined by the class name, action and category. So here to make
> it possible to keep multiple notifications for one web app. The notification
> id will be used as category for the pending intents.
>
> 9.       Upstream alignment:
>
> a.       Chromium doesn’t have implementation for web notification on
> android. Neither chrome nor chrome webview. As discussed with them, they
> want to propose to enhance the web notification spec to allow notification
> to carry meta data and specified URL. Which allows the page to be completely
> restored from the notification even it was gone.
>
> b.      If we wait for upstream, it will be a long time.
>
> c.       The idea of this intent is to spend minimum effort to implement the
> workable current version of web notification.
>
>
>
> Thanks,
>
> Shiliu.
>
>
>
>
> _______________________________________________
> Crosswalk-dev mailing list
> Crosswalk-dev@lists.crosswalk-project.org
> https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev
>



-- 
Kenneth Rohde Christiansen
Web Platform Architect, Intel Corporation.
Phone  +45 4294 9458 ﹆﹆﹆
_______________________________________________
Crosswalk-dev mailing list
Crosswalk-dev@lists.crosswalk-project.org
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

Reply via email to