Web Background Service
A labs.ericsson.com enabler
https://labs.ericsson.com/apis/web-background-service/
Web Background service
 A stand-alone Java application that runs on
 Android as well as on platforms supporting
 Java Stan...
Web Background features
 The background JavaScript code can use
 APIs such as XMLHttpRequest to
 communicate over the netw...
Web Background example
 Simple banana counting script running
 in the Web Background service
 The background script update...
Web Background example
 Web application running in the browser
<html>
<head>
<title>Simple Web Background application</tit...
Web Background example
 persistent.js (running in the WB service)
var count = 0;
var notification;
wb.client.importFunctio...
7
Upcoming SlideShare
Loading in...5
×

Web background service on labs

787

Published on

The Web Background service enables web applications to run partly in the background, even when the browser is not running. The part of the JavaScript code that is executed in the background can use APIs such as XMLHttpRequest to communicate over the network and Web Notifications to get the user's attention.

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
787
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Web background service on labs

  1. 1. Web Background Service A labs.ericsson.com enabler https://labs.ericsson.com/apis/web-background-service/
  2. 2. Web Background service A stand-alone Java application that runs on Android as well as on platforms supporting Java Standard Edition Enables web applications, running in the browser, to run part of the application logic in the background The JavaScript code running in the background will continue to run when the associated web application running in the browser is closed 2
  3. 3. Web Background features The background JavaScript code can use APIs such as XMLHttpRequest to communicate over the network and Web Notifications to get the user's attention Remote Procedure Call (RPC) bridge allows for simple interaction between the main application and the background code Management Console lets the user manage currently running background applications 3
  4. 4. Web Background example Simple banana counting script running in the Web Background service The background script updates the web page with the current banana count using RPC When the web application running in the browser is closed, notifications are used to alert the user 4
  5. 5. Web Background example Web application running in the browser <html> <head> <title>Simple Web Background application</title> <script src="wb.js"></script> <!– bootstrap script --> <script> wb.onload = function () { wb.enable("icon.png", document.title, "Here's the description", "persistent.js"); }; function log(msg) { document.body.innerHTML += msg + "<br>"; } </script> </head> <body> </body> </html> 5
  6. 6. Web Background example persistent.js (running in the WB service) var count = 0; var notification; wb.client.importFunctions("log"); wb.client.onconnect = function () { setInterval(function() { var msg = "number of bananas: " + count++; if (wb.client.connected) wb.client.log(msg); else { if (notification) notification.cancel(); notification = notifications.createNotification("icon.png", ”Banana count", msg); notification.show(); } }, 3000); }; 6
  7. 7. 7
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×