SlideShare une entreprise Scribd logo
1  sur  14
Télécharger pour lire hors ligne
FIREFOX OS	

LONDON MEETUP	

FEBRUARY 2014
!

Hands on Web Activities
WELCOME!
Today we are going to have a
practical session around	

!

Web Activities
!

(and the new app manager!)
WHAT ARE WEB ACTIVITIES?
Web activities are one way for applications to
interact which each other.	

We delegate a functionality on a different
application and wait for the result.
STARTING AN ACTIVITY	

SYNTAX
var activity = new MozActivity({
name: "/*Verb, usally 'pick', 'open', 'share' ...*/",
data: {
// We can pass parameters to the activity
}
});
!
activity.onsuccess = function() {
// Success return from the activity
// We can ask for the result, if any
var result = this.result;
console.log(result);
};
!
activity.onerror = function() {
// Called when a error happened
console.log(this.error);
};
WHERE CAN I FIND THEM?

https://developer.mozilla.org/en-US/docs/WebAPI/Web_Activities
EXAMPLE	

HTTPS://GITHUB.COM/FIREFOXOS-LONDON-MEETUP/USING-WEB-ACTIVITIES
OFFERING OUR SERVICES
•

Is your app particularly
good doing some task?	


•

Do you want to drive more
users to your app?	


•

Make other developers to
recognise your work!
DEFINING AN ACTIVITY
3 simple steps

•

Define it on your application manifest.	


•

Handle the activity request.	


•

Return the result of the activity.
DEFINE THE ACTIVITY	

IN YOUR MANIFEST FILE
{
// Your manifest goes here

!

}

// Activity registration, you can define as much
// as you want
"activities": {
// It starts with the verb (pick, share, new ..
"pick": {
// Document to be opened
"href": "./index.html",
// How the activity will be opened
"disposition": "inline",
// Extra data to filter if we can handle
// the activity request
"filters": {
"type": ["image/*","image/jpeg","image/png"]
},
"returnValue": true
}
}
HANDLING THE ACTION
navigator.mozSetMessageHandler('activity', function(activityRequest) {
var options = activityRequest.source;
!

// In options.name we have the verb used
console.log(options.name);
// options.data will contain the object
// we used to invoke the activity
console.log(options.data);
!

});
RETURN THE RESULT
navigator.mozSetMessageHandler('activity', function(activityRequest) {
// Send back the result
if (result) {
activityRequest.postResult(result);
} else {
activityRequest.postError("Error executing the activity");
}
});
EXAMPLE	


HTTPS://GITHUB.COM/FIREFOXOS-LONDON-MEETUP/
DEFINING-WEB-ACTIVITIES
THANKS!

Contenu connexe

Similaire à Firefoxos London Meetup February 2014: Hands on Web Activities

Open Web Device: The first phone running Firefox OS!
Open Web Device: The first phone running Firefox OS!Open Web Device: The first phone running Firefox OS!
Open Web Device: The first phone running Firefox OS!
Francisco Jordano
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
Christian Heilmann
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
NAVER D2
 
Firefox os-introduction
Firefox os-introductionFirefox os-introduction
Firefox os-introduction
zsoltlengyelit
 
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
 

Similaire à Firefoxos London Meetup February 2014: Hands on Web Activities (20)

Open Web Device: The first phone running Firefox OS!
Open Web Device: The first phone running Firefox OS!Open Web Device: The first phone running Firefox OS!
Open Web Device: The first phone running Firefox OS!
 
Native Javascript apps with Phonegap - De Keijzer
Native Javascript apps with Phonegap - De KeijzerNative Javascript apps with Phonegap - De Keijzer
Native Javascript apps with Phonegap - De Keijzer
 
Native Javascript apps with PhoneGap 11-04-2014 Codemotion Rome
Native Javascript apps with PhoneGap 11-04-2014 Codemotion RomeNative Javascript apps with PhoneGap 11-04-2014 Codemotion Rome
Native Javascript apps with PhoneGap 11-04-2014 Codemotion Rome
 
Firefox OS Presentation
Firefox OS PresentationFirefox OS Presentation
Firefox OS Presentation
 
Selenium, Appium, and Robots!
Selenium, Appium, and Robots!Selenium, Appium, and Robots!
Selenium, Appium, and Robots!
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
4Developers 2015: People don't give a f**k of JavaScript - Aurelio De Rosa
4Developers 2015: People don't give a f**k of JavaScript - Aurelio De Rosa4Developers 2015: People don't give a f**k of JavaScript - Aurelio De Rosa
4Developers 2015: People don't give a f**k of JavaScript - Aurelio De Rosa
 
A gently introduction to AngularJS
A gently introduction to AngularJSA gently introduction to AngularJS
A gently introduction to AngularJS
 
Firefox OS - HTML5 for a truly world-wide-web
Firefox OS - HTML5 for a truly world-wide-webFirefox OS - HTML5 for a truly world-wide-web
Firefox OS - HTML5 for a truly world-wide-web
 
Micro Front-Ends
Micro Front-EndsMicro Front-Ends
Micro Front-Ends
 
Lightning Talk - Xamarin
Lightning Talk - Xamarin Lightning Talk - Xamarin
Lightning Talk - Xamarin
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
 
Firefox os-introduction
Firefox os-introductionFirefox os-introduction
Firefox os-introduction
 
Ajaxworld Opensocial Presentation
Ajaxworld Opensocial PresentationAjaxworld Opensocial Presentation
Ajaxworld Opensocial Presentation
 
How to Get the Best MoBull Experience
How to Get the Best MoBull ExperienceHow to Get the Best MoBull Experience
How to Get the Best MoBull Experience
 
Mobile optimization
Mobile optimizationMobile optimization
Mobile optimization
 
Struts Intro
Struts IntroStruts Intro
Struts Intro
 
Mean stack Magics
Mean stack MagicsMean stack Magics
Mean stack Magics
 
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...
 
Mobile Web on Touch Event and YUI
Mobile Web on Touch Event and YUIMobile Web on Touch Event and YUI
Mobile Web on Touch Event and YUI
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Firefoxos London Meetup February 2014: Hands on Web Activities

  • 1. FIREFOX OS LONDON MEETUP FEBRUARY 2014 ! Hands on Web Activities
  • 2. WELCOME! Today we are going to have a practical session around ! Web Activities ! (and the new app manager!)
  • 3. WHAT ARE WEB ACTIVITIES? Web activities are one way for applications to interact which each other. We delegate a functionality on a different application and wait for the result.
  • 4.
  • 5. STARTING AN ACTIVITY SYNTAX var activity = new MozActivity({ name: "/*Verb, usally 'pick', 'open', 'share' ...*/", data: { // We can pass parameters to the activity } }); ! activity.onsuccess = function() { // Success return from the activity // We can ask for the result, if any var result = this.result; console.log(result); }; ! activity.onerror = function() { // Called when a error happened console.log(this.error); };
  • 6. WHERE CAN I FIND THEM? https://developer.mozilla.org/en-US/docs/WebAPI/Web_Activities
  • 8. OFFERING OUR SERVICES • Is your app particularly good doing some task? • Do you want to drive more users to your app? • Make other developers to recognise your work!
  • 9. DEFINING AN ACTIVITY 3 simple steps • Define it on your application manifest. • Handle the activity request. • Return the result of the activity.
  • 10. DEFINE THE ACTIVITY IN YOUR MANIFEST FILE { // Your manifest goes here ! } // Activity registration, you can define as much // as you want "activities": { // It starts with the verb (pick, share, new .. "pick": { // Document to be opened "href": "./index.html", // How the activity will be opened "disposition": "inline", // Extra data to filter if we can handle // the activity request "filters": { "type": ["image/*","image/jpeg","image/png"] }, "returnValue": true } }
  • 11. HANDLING THE ACTION navigator.mozSetMessageHandler('activity', function(activityRequest) { var options = activityRequest.source; ! // In options.name we have the verb used console.log(options.name); // options.data will contain the object // we used to invoke the activity console.log(options.data); ! });
  • 12. RETURN THE RESULT navigator.mozSetMessageHandler('activity', function(activityRequest) { // Send back the result if (result) { activityRequest.postResult(result); } else { activityRequest.postError("Error executing the activity"); } });