際際滷

際際滷Share a Scribd company logo
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 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
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
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
Web Background example
 Web application running in the browser
<html>
<head>
<title>Simple Web Background application</title>
<script src=/slideshow/web-background-service-on-labs/5123113/"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
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

More Related Content

Similar to Web background service on labs (20)

"Service Worker: Let Your Web App Feel Like a Native "
"Service Worker: Let Your Web App Feel Like a Native ""Service Worker: Let Your Web App Feel Like a Native "
"Service Worker: Let Your Web App Feel Like a Native "
FDConf
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
Robert Nyman
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Robert Nyman
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.js
Robert Nyman
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWT
Arnaud Tournier
HTML5 WebWorks
HTML5 WebWorksHTML5 WebWorks
HTML5 WebWorks
Raul Jimenez
Firefox OS workshop, JSFoo, India
Firefox OS workshop, JSFoo, IndiaFirefox OS workshop, JSFoo, India
Firefox OS workshop, JSFoo, India
Robert Nyman
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
Fastly
Implementing and Visualizing Clickstream data with MongoDB
Implementing and Visualizing Clickstream data with MongoDBImplementing and Visualizing Clickstream data with MongoDB
Implementing and Visualizing Clickstream data with MongoDB
MongoDB
Front-end. Global domination
Front-end. Global dominationFront-end. Global domination
Front-end. Global domination
Stfalcon Meetups
Frontend. Global domination.
Frontend. Global domination.Frontend. Global domination.
Frontend. Global domination.
仆亟亠亶 舒仆亟舒从仂于
NodeJS
NodeJSNodeJS
NodeJS
Alok Guha
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
Yan Shi
Building Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devicesBuilding Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devices
Windows Developer
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19
Vivek Singh Chandel
Offline Application Cache
Offline Application CacheOffline Application Cache
Offline Application Cache
Jonathan Stark
Creating Rajanikant Powered Site
Creating Rajanikant Powered SiteCreating Rajanikant Powered Site
Creating Rajanikant Powered Site
markandey
"Service Worker: Let Your Web App Feel Like a Native "
"Service Worker: Let Your Web App Feel Like a Native ""Service Worker: Let Your Web App Feel Like a Native "
"Service Worker: Let Your Web App Feel Like a Native "
FDConf
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha
WebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla LondonWebAPIs & Apps - Mozilla London
WebAPIs & Apps - Mozilla London
Robert Nyman
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
Robert Nyman
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
WebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.jsWebAPIs & WebRTC - Spotify/sthlm.js
WebAPIs & WebRTC - Spotify/sthlm.js
Robert Nyman
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWT
Arnaud Tournier
Firefox OS workshop, JSFoo, India
Firefox OS workshop, JSFoo, IndiaFirefox OS workshop, JSFoo, India
Firefox OS workshop, JSFoo, India
Robert Nyman
Solving anything in VCL
Solving anything in VCLSolving anything in VCL
Solving anything in VCL
Fastly
Implementing and Visualizing Clickstream data with MongoDB
Implementing and Visualizing Clickstream data with MongoDBImplementing and Visualizing Clickstream data with MongoDB
Implementing and Visualizing Clickstream data with MongoDB
MongoDB
Front-end. Global domination
Front-end. Global dominationFront-end. Global domination
Front-end. Global domination
Stfalcon Meetups
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
Yan Shi
Building Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devicesBuilding Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devices
Windows Developer
Offline Application Cache
Offline Application CacheOffline Application Cache
Offline Application Cache
Jonathan Stark
Creating Rajanikant Powered Site
Creating Rajanikant Powered SiteCreating Rajanikant Powered Site
Creating Rajanikant Powered Site
markandey

More from Tor Bj旦rn Minde (18)

OvertheAir 2010 html5 impact on application programming
OvertheAir 2010 html5 impact on application programmingOvertheAir 2010 html5 impact on application programming
OvertheAir 2010 html5 impact on application programming
Tor Bj旦rn Minde
Network Probe On Labs
Network Probe On LabsNetwork Probe On Labs
Network Probe On Labs
Tor Bj旦rn Minde
Mobile Sensor Actuator Gateway On Labs
Mobile Sensor Actuator Gateway On LabsMobile Sensor Actuator Gateway On Labs
Mobile Sensor Actuator Gateway On Labs
Tor Bj旦rn Minde
Converting Media On Labs
Converting Media On LabsConverting Media On Labs
Converting Media On Labs
Tor Bj旦rn Minde
Event Source On Labs
Event Source On LabsEvent Source On Labs
Event Source On Labs
Tor Bj旦rn Minde
Mobile Identification On Labs
Mobile Identification On LabsMobile Identification On Labs
Mobile Identification On Labs
Tor Bj旦rn Minde
Face Detector On Labs
Face Detector On LabsFace Detector On Labs
Face Detector On Labs
Tor Bj旦rn Minde
Web Connectivity On Labs
Web Connectivity On LabsWeb Connectivity On Labs
Web Connectivity On Labs
Tor Bj旦rn Minde
3D Landscape on Labs
3D Landscape on Labs3D Landscape on Labs
3D Landscape on Labs
Tor Bj旦rn Minde
Mobile Location On Labs
Mobile Location On LabsMobile Location On Labs
Mobile Location On Labs
Tor Bj旦rn Minde
Streaming Media On Labs
Streaming Media On LabsStreaming Media On Labs
Streaming Media On Labs
Tor Bj旦rn Minde
Ericsson Labs OTA09 090925
Ericsson Labs OTA09 090925Ericsson Labs OTA09 090925
Ericsson Labs OTA09 090925
Tor Bj旦rn Minde
Web Location On Labs
Web Location On LabsWeb Location On Labs
Web Location On Labs
Tor Bj旦rn Minde
Ericsson Labs 090702
Ericsson Labs 090702Ericsson Labs 090702
Ericsson Labs 090702
Tor Bj旦rn Minde
Mobile Maps On Labs
Mobile Maps On LabsMobile Maps On Labs
Mobile Maps On Labs
Tor Bj旦rn Minde
SMS On Labs
SMS On LabsSMS On Labs
SMS On Labs
Tor Bj旦rn Minde
Mobile Java Push On Labs
Mobile Java Push On LabsMobile Java Push On Labs
Mobile Java Push On Labs
Tor Bj旦rn Minde
IMS framework On Labs
IMS framework On LabsIMS framework On Labs
IMS framework On Labs
Tor Bj旦rn Minde

Recently uploaded (20)

A-Z GENERAL QUIZ | THE QUIZ CLUB OF PSGCAS | 14TH MARCH 2025.pptx
A-Z GENERAL QUIZ | THE QUIZ CLUB OF PSGCAS | 14TH MARCH 2025.pptxA-Z GENERAL QUIZ | THE QUIZ CLUB OF PSGCAS | 14TH MARCH 2025.pptx
A-Z GENERAL QUIZ | THE QUIZ CLUB OF PSGCAS | 14TH MARCH 2025.pptx
Quiz Club of PSG College of Arts & Science
Analysis of Conf File Parameters in Odoo 17
Analysis of Conf File Parameters in Odoo 17Analysis of Conf File Parameters in Odoo 17
Analysis of Conf File Parameters in Odoo 17
Celine George
Unit No. 4 - Immunopharmacologyslides.pptx
Unit No. 4 - Immunopharmacologyslides.pptxUnit No. 4 - Immunopharmacologyslides.pptx
Unit No. 4 - Immunopharmacologyslides.pptx
Ashish Umale
How to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in OdooHow to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in Odoo
Celine George
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷sPurchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Celine George
Managing Online Signature and Payment with Odoo 17
Managing Online Signature and Payment with Odoo 17Managing Online Signature and Payment with Odoo 17
Managing Online Signature and Payment with Odoo 17
Celine George
MIPLM subject matter expert Sascha Kamhuber
MIPLM subject matter expert Sascha KamhuberMIPLM subject matter expert Sascha Kamhuber
MIPLM subject matter expert Sascha Kamhuber
MIPLM
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
All India Council of Skills and Vocational Studies (AICSVS) PROSPECTUS 2025
National Council of Open Schooling Research and Training
Conrad "Accessibility Essentials: Introductory Seminar"
Conrad "Accessibility Essentials: Introductory Seminar"Conrad "Accessibility Essentials: Introductory Seminar"
Conrad "Accessibility Essentials: Introductory Seminar"
National Information Standards Organization (NISO)
Studying and Notetaking: Some Suggestions
Studying and Notetaking: Some SuggestionsStudying and Notetaking: Some Suggestions
Studying and Notetaking: Some Suggestions
Damian T. Gordon
Different perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdfDifferent perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdf
Aivar Ruukel
NURSING PROCESS AND ITS STEPS .pptx
NURSING PROCESS AND ITS STEPS                 .pptxNURSING PROCESS AND ITS STEPS                 .pptx
NURSING PROCESS AND ITS STEPS .pptx
PoojaSen20
Marketing Management (16th edition) Philip Kotler
Marketing Management (16th edition) Philip KotlerMarketing Management (16th edition) Philip Kotler
Marketing Management (16th edition) Philip Kotler
menhutamizh
ISO 42001 2023 Audit and Control Checklist
ISO 42001 2023 Audit and Control ChecklistISO 42001 2023 Audit and Control Checklist
ISO 42001 2023 Audit and Control Checklist
priyanshamadhwal2
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VIAnti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Samruddhi Khonde
Introduction to Systematic Reviews - Prof Ejaz Khan
Introduction to Systematic Reviews - Prof Ejaz KhanIntroduction to Systematic Reviews - Prof Ejaz Khan
Introduction to Systematic Reviews - Prof Ejaz Khan
Systematic Reviews Network (SRN)
How to manage Customer Tips with Odoo 17 Point Of Sale
How to manage Customer Tips with Odoo 17 Point Of SaleHow to manage Customer Tips with Odoo 17 Point Of Sale
How to manage Customer Tips with Odoo 17 Point Of Sale
Celine George
technology in banking ppt FOR E-CONTENT -2.ppt
technology in banking ppt  FOR E-CONTENT -2.ppttechnology in banking ppt  FOR E-CONTENT -2.ppt
technology in banking ppt FOR E-CONTENT -2.ppt
HARIHARAN A
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
Prabhakar Singh Patel
Generative artificial intelligence - conceptual changes
Generative artificial intelligence - conceptual changesGenerative artificial intelligence - conceptual changes
Generative artificial intelligence - conceptual changes
Peter Trkman
Analysis of Conf File Parameters in Odoo 17
Analysis of Conf File Parameters in Odoo 17Analysis of Conf File Parameters in Odoo 17
Analysis of Conf File Parameters in Odoo 17
Celine George
Unit No. 4 - Immunopharmacologyslides.pptx
Unit No. 4 - Immunopharmacologyslides.pptxUnit No. 4 - Immunopharmacologyslides.pptx
Unit No. 4 - Immunopharmacologyslides.pptx
Ashish Umale
How to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in OdooHow to process Interwarehouse and Intrawarehouse transfers in Odoo
How to process Interwarehouse and Intrawarehouse transfers in Odoo
Celine George
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷sPurchase Analysis in Odoo 17 - Odoo 際際滷s
Purchase Analysis in Odoo 17 - Odoo 際際滷s
Celine George
Managing Online Signature and Payment with Odoo 17
Managing Online Signature and Payment with Odoo 17Managing Online Signature and Payment with Odoo 17
Managing Online Signature and Payment with Odoo 17
Celine George
MIPLM subject matter expert Sascha Kamhuber
MIPLM subject matter expert Sascha KamhuberMIPLM subject matter expert Sascha Kamhuber
MIPLM subject matter expert Sascha Kamhuber
MIPLM
Studying and Notetaking: Some Suggestions
Studying and Notetaking: Some SuggestionsStudying and Notetaking: Some Suggestions
Studying and Notetaking: Some Suggestions
Damian T. Gordon
Different perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdfDifferent perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdf
Aivar Ruukel
NURSING PROCESS AND ITS STEPS .pptx
NURSING PROCESS AND ITS STEPS                 .pptxNURSING PROCESS AND ITS STEPS                 .pptx
NURSING PROCESS AND ITS STEPS .pptx
PoojaSen20
Marketing Management (16th edition) Philip Kotler
Marketing Management (16th edition) Philip KotlerMarketing Management (16th edition) Philip Kotler
Marketing Management (16th edition) Philip Kotler
menhutamizh
ISO 42001 2023 Audit and Control Checklist
ISO 42001 2023 Audit and Control ChecklistISO 42001 2023 Audit and Control Checklist
ISO 42001 2023 Audit and Control Checklist
priyanshamadhwal2
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VIAnti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Samruddhi Khonde
How to manage Customer Tips with Odoo 17 Point Of Sale
How to manage Customer Tips with Odoo 17 Point Of SaleHow to manage Customer Tips with Odoo 17 Point Of Sale
How to manage Customer Tips with Odoo 17 Point Of Sale
Celine George
technology in banking ppt FOR E-CONTENT -2.ppt
technology in banking ppt  FOR E-CONTENT -2.ppttechnology in banking ppt  FOR E-CONTENT -2.ppt
technology in banking ppt FOR E-CONTENT -2.ppt
HARIHARAN A
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
URINE SPECIMEN COLLECTION AND HANDLING CLASS 1 FOR ALL PARAMEDICAL OR CLINICA...
Prabhakar Singh Patel
Generative artificial intelligence - conceptual changes
Generative artificial intelligence - conceptual changesGenerative artificial intelligence - conceptual changes
Generative artificial intelligence - conceptual changes
Peter Trkman

Web background service on labs

  • 1. Web Background Service A labs.ericsson.com enabler https://labs.ericsson.com/apis/web-background-service/
  • 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. 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. 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. Web Background example Web application running in the browser <html> <head> <title>Simple Web Background application</title> <script src=/slideshow/web-background-service-on-labs/5123113/"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. 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