SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
2G
                       H onB
                     IT ati
                    W mis
                  G
                IN d custo                                               es

              CK an                                                 bH
                                                                      aw
                                                                        k

             A pps
            H ba
                                                                  Ro



                        We

Hi, I’m Rob Hawkes and this is a little intro to hacking around with Boot to Gecko.
B2G                                        Gaia
B2G is actually two separate things; B2G and Gaia

The B2G side is the hardware-related stuff and JavaScript APIs that we need to make the
phone work.

The B2G side is pretty much everything that you don’t see.
Gaia is the stuff you can see and the things you can interact with.

Although you can hack around with and help with the core Boot to Gecko functionality, you’ll
probably
be most interested in the front-end Gaia operating system and the Web apps that can be
created for it.
a y
                                                        d
                                                      to ns
                                                  2 G       tio
                                             g B          op
                                          sin are a f  ew
                                         U     he
                                                 re
                                                    T




There are a 2 main options to start using and playing with B2G this evening.
If you have some knowledge of git, you can clone the Gaia repository and launch Gaia using a
recent Firefox Nightly build.

Pros: 
- No build system  and very little setup required
- Can use the Firefox dev tools

Cons:
- The viewport is based on the size of the browser window
- Many device-like things won't work
- Apps are launched in separate, pinned tabs
- Firefox Nightly might be unstable

http://nightly.mozilla.org
https://github.com/andreasgal/gaia/
There is also gaia-devserver, a node-based tool for developing Gaia in Firefox Nightly.

https://github.com/jrburke/gaia-devserver
Gaia in Nightly




You’ll have to resize the browser to get it looking right but it’s a great way to quickly play
with Gaia and start developing apps for it.
B2G Device




The other option is to use one of the 3 B2G devices that I’ve brought along this evening.

https://developer.mozilla.org/en/Mozilla/Boot_to_Gecko#Setting_up_.
26_building_Boot_to_Gecko
p s
                                                    Ap
                                              W  eb Gecko
                                           pen r Boot to
                                          O   ps
                                                 fo
                                                    ap
                                                 ng
                                              ati
                                           Cre



Open Web Apps is an initiative that is core to B2G and one that is important to the Web as a
whole.

It’s a way of creating and distributing apps that puts the developers and users of apps back
in charge.

It’s a way that embraces open technology and is for the good of the Web.
te d
                                                           r
                                                       ta app
                                                   g s
                                               ttin         te
                                                               an
                                             Ge      to
                                                        crea
                                                       How




Creating a Web app isn’t crazy hard, it’s just a case of understanding the new features in
browsers.

https://developer.mozilla.org/en/Apps
tes
                                                          bsi
                                                        we     olo
                                                                  gy
                                         ar e         tec
                                                         hn
                                      ps           me
                                    Ap     et
                                              he
                                                 sa
                                         us
                                             ey
                                           Th



Apps are websites and are built using the same technology and processes.

If you already know how to make a website then creating your first Web app is a breeze.
fe st
                                                     n  i
                                                   a
                                                m o an a       pp
                                          io  n         int
                                       a t          ite
                                   plic         we
                                                  bs
                                 Ap      rninga
                                       Tu



The only thing that you need to do to turn a website into app is create an application
manifest.
{
              "version": "1.0",
              "name": "MozillaBall",
              "description": "Exciting Open Web development action!",
              "icons": {
                 "16": "/img/icon-16.png",
                 "48": "/img/icon-48.png",
                 "128": "/img/icon-128.png"
              },
              "developer": {
                 "name": "Mozilla Labs",
                 "url": "http://mozillalabs.com"
              },
              "installs_allowed_from": [
                 "https://appstore.mozillalabs.com"
              ],
              "default_locale": "en"
          }


This is a JSON file that effectively describes your application; it’s name, icons, and other
related data.
nts
                                                 e
                                          irem ember
                                     q  u
                                 t re         ttor
                                                  em

                              fes          tan
                            ni         mp
                                         or
                          Ma          I




There are a couple of important things to remember when creating an application manifest.
a in
                                                       o m ty
                                                    e d      curi
                                                  am nt of se
                                                 S    me
                                                           ele
                                                        An




The first is that it needs to be hosted from the same domain as your Web app.

This is pretty straightforward and it adds an element of security in that it is unlikely that a
rouge manifest file will be able to be put on the same domain without your knowledge.
Content-type header




       application/x-web-app-manifest+json




The second is that it needs to be served with a specific content type (application/x-web-app-
manifest+json).

This is probably the most tricky process in turning a website into an app as it involves
changing settings on your server or a bit of hackery in your manifest file.

If you don’t want to fiddle with your server then you can always set the content-type header
using something like PHP or Node.js.
to r
                                                               a
                                                            lid s ok
                                                          va
                                            st           hin
                                                                 g i

                                        nife       everyt
                                      Ma      su
                                                re
                                                 king
                                               Ma




If you want to make sure your manifest is valid you can have it checked at http://
appmanifest.org
p s
                                                         a p
                                                   lin g          ce
                                                tal          etp
                                                                la

                                             Ins        rM
                                                          ark
                                                    sero
                                                brow
                                            the
                                         gh
                                     hrou
                                    T


You can install apps in B2G through the browser or the Mozilla Marketplace.

You can also install apps on the desktop and Android using Firefox.
Installing an app




      navigator.mozApps.install(manifestUrl)




Behind the scenes, installing an app is achieved through the new mozApps JavaScript API.

By passing the ‘install’ method a string URL to the app’s manifest file you will trigger the
installation process.

An example of when you would call this method is after a user clicks on an “Install this app”
button on your own website.

It would be called automatically if your app was installed from the Mozilla Marketplace, or any
other external website.
The install method triggers an installation dialogue within the browser that allows the user to
decide what to do with the app.

On Windows, a desktop shortcut is created for the app you installed and it will also be in the
start menu.

On Mac, the app is added to your /Applications directory.

On B2G, the app is added to your homescreen.
ery
                                                        a ck ce
                                                    ia h        de
                                                                  vi
                                                  Ga       ot
                                                             he
                                                    ak   st
                                                   e
                                                 tw
                                              nd
                                            sa
                                          pp
                                        ga
                                     hin
                                  Pus


The 3 devices that I’ve brought along for you today are already set up ready to have
applications pushed to them and things tweaked.

To do that you’ll need to plug the device into your computer and directly push updates to it.

This approach is useful for development as it allows you to quickly test things without having
to upload the app to the Web and installing or updating it from there.

https://wiki.mozilla.org/B2G/DeveloperPhone#Advanced_Gaia_Hacking
The first thing you need is the Android Debug Bridge.

This allows you to communicate between your computer and the B2G device via a USB cable.

http://developer.android.com/sdk/index.html
Dev installation




         https://github.com/andreasgal/gaia/




The next step, if you haven’t got it already, is to download Gaia from GitHub.

The very latest version may be unstable so it’s recommended to use the build that we’ve
brought along and can provide you on a memory stick.

https://github.com/andreasgal/gaia/
Dev installation




             Add app to ‘../gaia/apps/myapp’




Once you have Gaia then add or create your application in the ‘../gaia/apps/myapp’
directory.

Make sure to include the application manifest file.
Dev installation




                            make install-gaia




The last step is to push your app and any Gaia updates to the device.

That’s it!
io n
                                                   ta  t
                                                en          ne
                                                              ed
                                           cum        ty
                                                         ou
                                         Do       gt
                                                    ha
                                              thin
                                                  ery
                                                Ev




Here are a few of the key places to go for documentation about developing on B2G and Open
Web Apps.
Boot to Gecko MDN documentation

https://developer.mozilla.org/en/Mozilla/Boot_to_Gecko
Gaia Hacking documentation

https://wiki.mozilla.org/Gaia/Hacking
Open Web Apps documentation

https://developer.mozilla.org/en/Apps
ge s
                                                           n
                                                        lle jects
                                                     cha      ro
                                          ack             ssiblep
                                         H           nd
                                                        po
                                                 easa
                                               Id




There are a few specific challenges that you might want to consider tonight.
p p
                                      b a
                                    We      xis
                                               ts
                          e       a    ad
                                          ye
                        at          lre
                     Cre     ortha
                                  ta
                           w
                             ne
                       thing
                      e
                   Som


Create a Web app
aia
                                                     e G
                                                  is
                                                m or fea   ture
                                             sto yle
                                           Cu       st
                                                new
                                                    a
                                                ate
                                             Cre



Customise Gaia by creating a new style or feature
u  e
                                                          iss
                                                      aia           tch
                                                   a G       it a
                                                                  pa

                                           Fix           su
                                                           bm
                                                      nd
                                                    ea
                                                  on
                                             Grab




Fix a Gaia issue from GitHub and submit a patch.
Rob Hawkes
                       @robhawkes




             Rawkes.com
             Personal website and blog

   RECENT PROJECTS                              MORE COOL STUFF


             Twitter sentiment analysis                   Rawket Scientist
             Delving into your soul                       Technical Evangelist at Mozilla


             Rawkets.com                                  Slides
             HTML5 & WebSockets game                      slideshare.net/robhawkes



Get in touch with me on Twitter: @robhawkes

Follow my blog (Rawkes) to keep up to date with stuff that I’m working on: http://
rawkes.com

I’ve recently worked on a project that analyses sentiment on Twitter: http://rawkes.com/
blog/2011/05/05/people-love-a-good-smooch-on-a-balcony

Rawkets is my multiplayer HTML5 and JavaScript game. Play it, it’s fun: http://rawkets.com

These slides are online at slideshare.net/robhawkes

Contenu connexe

En vedette

2012.09.27 Learning Sessions 3 - Houston Center for Photograhy
2012.09.27 Learning Sessions 3 - Houston Center for Photograhy2012.09.27 Learning Sessions 3 - Houston Center for Photograhy
2012.09.27 Learning Sessions 3 - Houston Center for Photograhyjvielman
 
Understanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationUnderstanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationRobin Hawkes
 
Rawkets - A Massively Multiplayer HTML5 Game [Mozilla GameOn10]
Rawkets - A Massively Multiplayer HTML5 Game [Mozilla GameOn10]Rawkets - A Massively Multiplayer HTML5 Game [Mozilla GameOn10]
Rawkets - A Massively Multiplayer HTML5 Game [Mozilla GameOn10]Robin Hawkes
 
財務個案分析報告 尖美建設
財務個案分析報告 尖美建設財務個案分析報告 尖美建設
財務個案分析報告 尖美建設Toomore
 
Winer istm dublin_20160909_d_final
Winer istm dublin_20160909_d_finalWiner istm dublin_20160909_d_final
Winer istm dublin_20160909_d_finalDov Winer
 
Melamar kerja & wawancara
Melamar kerja & wawancaraMelamar kerja & wawancara
Melamar kerja & wawancaraNur Agustinus
 
XPers/失われたリール《腰索》
XPers/失われたリール《腰索》XPers/失われたリール《腰索》
XPers/失われたリール《腰索》ledsun
 
IIG_IFCA_Presentation-0909
IIG_IFCA_Presentation-0909IIG_IFCA_Presentation-0909
IIG_IFCA_Presentation-0909iigsolutions
 
MozTW 離線報
MozTW 離線報MozTW 離線報
MozTW 離線報Toomore
 
YPT10J BENUTZERHANDBUCH
YPT10J BENUTZERHANDBUCHYPT10J BENUTZERHANDBUCH
YPT10J BENUTZERHANDBUCHjulia135
 
YPT10J BENUTZERHANDBUCH
YPT10J BENUTZERHANDBUCHYPT10J BENUTZERHANDBUCH
YPT10J BENUTZERHANDBUCHjulia135
 
2013 04 cbi informational residency incubator final slideshare
2013 04 cbi informational   residency incubator final slideshare2013 04 cbi informational   residency incubator final slideshare
2013 04 cbi informational residency incubator final slidesharejvielman
 
First marathon
First marathonFirst marathon
First marathonmorea02
 
Rawkets: An inside look at a multiplayer HTML5 game
Rawkets: An inside look at a multiplayer HTML5 gameRawkets: An inside look at a multiplayer HTML5 game
Rawkets: An inside look at a multiplayer HTML5 gameRobin Hawkes
 
2013 01 24 learning sessions 4 presentation hope stone
2013 01 24 learning sessions 4 presentation   hope stone2013 01 24 learning sessions 4 presentation   hope stone
2013 01 24 learning sessions 4 presentation hope stonejvielman
 

En vedette (20)

2012.09.27 Learning Sessions 3 - Houston Center for Photograhy
2012.09.27 Learning Sessions 3 - Houston Center for Photograhy2012.09.27 Learning Sessions 3 - Houston Center for Photograhy
2012.09.27 Learning Sessions 3 - Houston Center for Photograhy
 
Understanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationUnderstanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisation
 
2009 2010 Presentation
2009 2010 Presentation2009 2010 Presentation
2009 2010 Presentation
 
Rawkets - A Massively Multiplayer HTML5 Game [Mozilla GameOn10]
Rawkets - A Massively Multiplayer HTML5 Game [Mozilla GameOn10]Rawkets - A Massively Multiplayer HTML5 Game [Mozilla GameOn10]
Rawkets - A Massively Multiplayer HTML5 Game [Mozilla GameOn10]
 
財務個案分析報告 尖美建設
財務個案分析報告 尖美建設財務個案分析報告 尖美建設
財務個案分析報告 尖美建設
 
Winer istm dublin_20160909_d_final
Winer istm dublin_20160909_d_finalWiner istm dublin_20160909_d_final
Winer istm dublin_20160909_d_final
 
Melamar kerja & wawancara
Melamar kerja & wawancaraMelamar kerja & wawancara
Melamar kerja & wawancara
 
XPers/失われたリール《腰索》
XPers/失われたリール《腰索》XPers/失われたリール《腰索》
XPers/失われたリール《腰索》
 
IIG_IFCA_Presentation-0909
IIG_IFCA_Presentation-0909IIG_IFCA_Presentation-0909
IIG_IFCA_Presentation-0909
 
Papiroflexia nueve figuras de papel 6 NIVEL BÁSICO
Papiroflexia nueve figuras de papel 6 NIVEL BÁSICOPapiroflexia nueve figuras de papel 6 NIVEL BÁSICO
Papiroflexia nueve figuras de papel 6 NIVEL BÁSICO
 
MozTW 離線報
MozTW 離線報MozTW 離線報
MozTW 離線報
 
YPT10J BENUTZERHANDBUCH
YPT10J BENUTZERHANDBUCHYPT10J BENUTZERHANDBUCH
YPT10J BENUTZERHANDBUCH
 
YPT10J BENUTZERHANDBUCH
YPT10J BENUTZERHANDBUCHYPT10J BENUTZERHANDBUCH
YPT10J BENUTZERHANDBUCH
 
2013 04 cbi informational residency incubator final slideshare
2013 04 cbi informational   residency incubator final slideshare2013 04 cbi informational   residency incubator final slideshare
2013 04 cbi informational residency incubator final slideshare
 
Helmi Suhaimi
Helmi SuhaimiHelmi Suhaimi
Helmi Suhaimi
 
Penilaian Hasil dan Dampak Program - shared version (180914)
Penilaian Hasil dan Dampak Program - shared version (180914)Penilaian Hasil dan Dampak Program - shared version (180914)
Penilaian Hasil dan Dampak Program - shared version (180914)
 
How to Win People Heart & Mind
How to Win People Heart & MindHow to Win People Heart & Mind
How to Win People Heart & Mind
 
First marathon
First marathonFirst marathon
First marathon
 
Rawkets: An inside look at a multiplayer HTML5 game
Rawkets: An inside look at a multiplayer HTML5 gameRawkets: An inside look at a multiplayer HTML5 game
Rawkets: An inside look at a multiplayer HTML5 game
 
2013 01 24 learning sessions 4 presentation hope stone
2013 01 24 learning sessions 4 presentation   hope stone2013 01 24 learning sessions 4 presentation   hope stone
2013 01 24 learning sessions 4 presentation hope stone
 

Similaire à Hacking with B2G – Web Apps and Customisation

Melbourne Geek Night - Boot to Gecko – The Web as a Platform
Melbourne Geek Night - Boot to Gecko – The Web as a PlatformMelbourne Geek Night - Boot to Gecko – The Web as a Platform
Melbourne Geek Night - Boot to Gecko – The Web as a PlatformRobin Hawkes
 
Open Web Apps and the Mozilla Labs Apps project
Open Web Apps and the Mozilla Labs Apps projectOpen Web Apps and the Mozilla Labs Apps project
Open Web Apps and the Mozilla Labs Apps projectRobin Hawkes
 
Browserscene: Creating demos on the Web
Browserscene: Creating demos on the WebBrowserscene: Creating demos on the Web
Browserscene: Creating demos on the WebRobin Hawkes
 
Tomorrow's Web and Future Technologies - WDC2011
Tomorrow's Web and Future Technologies - WDC2011Tomorrow's Web and Future Technologies - WDC2011
Tomorrow's Web and Future Technologies - WDC2011Robin Hawkes
 
Java based Cross-Platform Mobile Development
Java based Cross-Platform Mobile DevelopmentJava based Cross-Platform Mobile Development
Java based Cross-Platform Mobile DevelopmentPeter Friese
 
Django Python(2)
Django Python(2)Django Python(2)
Django Python(2)tomcoh
 
Awesome Technology on the Web - Oxygen Accelerator
Awesome Technology on the Web - Oxygen AcceleratorAwesome Technology on the Web - Oxygen Accelerator
Awesome Technology on the Web - Oxygen AcceleratorRobin Hawkes
 
Gig Monkey at Facebook Garage Ireland 2
Gig Monkey at Facebook Garage Ireland 2Gig Monkey at Facebook Garage Ireland 2
Gig Monkey at Facebook Garage Ireland 2Web2 Ireland
 
What is the best programming language for beginner?
What is the best programming language for beginner?What is the best programming language for beginner?
What is the best programming language for beginner?Designveloper
 
Inside Rawkets - onGameStart
Inside Rawkets - onGameStartInside Rawkets - onGameStart
Inside Rawkets - onGameStartRobin Hawkes
 
HTML5 & JavaScript: The Future Now
HTML5 & JavaScript: The Future NowHTML5 & JavaScript: The Future Now
HTML5 & JavaScript: The Future NowRobin Hawkes
 
Mozilla Firefox: Present and Future - Fluent JS
Mozilla Firefox: Present and Future - Fluent JSMozilla Firefox: Present and Future - Fluent JS
Mozilla Firefox: Present and Future - Fluent JSRobin Hawkes
 

Similaire à Hacking with B2G – Web Apps and Customisation (16)

Melbourne Geek Night - Boot to Gecko – The Web as a Platform
Melbourne Geek Night - Boot to Gecko – The Web as a PlatformMelbourne Geek Night - Boot to Gecko – The Web as a Platform
Melbourne Geek Night - Boot to Gecko – The Web as a Platform
 
Open Web Apps and the Mozilla Labs Apps project
Open Web Apps and the Mozilla Labs Apps projectOpen Web Apps and the Mozilla Labs Apps project
Open Web Apps and the Mozilla Labs Apps project
 
Browserscene: Creating demos on the Web
Browserscene: Creating demos on the WebBrowserscene: Creating demos on the Web
Browserscene: Creating demos on the Web
 
Tomorrow's Web and Future Technologies - WDC2011
Tomorrow's Web and Future Technologies - WDC2011Tomorrow's Web and Future Technologies - WDC2011
Tomorrow's Web and Future Technologies - WDC2011
 
Java based Cross-Platform Mobile Development
Java based Cross-Platform Mobile DevelopmentJava based Cross-Platform Mobile Development
Java based Cross-Platform Mobile Development
 
Django Python(2)
Django Python(2)Django Python(2)
Django Python(2)
 
Awesome Technology on the Web - Oxygen Accelerator
Awesome Technology on the Web - Oxygen AcceleratorAwesome Technology on the Web - Oxygen Accelerator
Awesome Technology on the Web - Oxygen Accelerator
 
Gig Monkey at Facebook Garage Ireland 2
Gig Monkey at Facebook Garage Ireland 2Gig Monkey at Facebook Garage Ireland 2
Gig Monkey at Facebook Garage Ireland 2
 
What is the best programming language for beginner?
What is the best programming language for beginner?What is the best programming language for beginner?
What is the best programming language for beginner?
 
Inside Rawkets - onGameStart
Inside Rawkets - onGameStartInside Rawkets - onGameStart
Inside Rawkets - onGameStart
 
HTML5 & JavaScript: The Future Now
HTML5 & JavaScript: The Future NowHTML5 & JavaScript: The Future Now
HTML5 & JavaScript: The Future Now
 
Mozilla Firefox: Present and Future - Fluent JS
Mozilla Firefox: Present and Future - Fluent JSMozilla Firefox: Present and Future - Fluent JS
Mozilla Firefox: Present and Future - Fluent JS
 
nikolas-resume
nikolas-resumenikolas-resume
nikolas-resume
 
digital ocean - 4.pptx
digital ocean - 4.pptxdigital ocean - 4.pptx
digital ocean - 4.pptx
 
digital ocean - 4.pptx
digital ocean - 4.pptxdigital ocean - 4.pptx
digital ocean - 4.pptx
 
Digital ocean 4
Digital ocean   4Digital ocean   4
Digital ocean 4
 

Plus de Robin Hawkes

ViziCities - Lessons Learnt Visualising Real-world Cities in 3D
ViziCities - Lessons Learnt Visualising Real-world Cities in 3DViziCities - Lessons Learnt Visualising Real-world Cities in 3D
ViziCities - Lessons Learnt Visualising Real-world Cities in 3DRobin Hawkes
 
Calculating building heights using a phone camera
Calculating building heights using a phone cameraCalculating building heights using a phone camera
Calculating building heights using a phone cameraRobin Hawkes
 
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataWebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataRobin Hawkes
 
Understanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationUnderstanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationRobin Hawkes
 
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGLViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGLRobin Hawkes
 
Beautiful Data Visualisation & D3
Beautiful Data Visualisation & D3Beautiful Data Visualisation & D3
Beautiful Data Visualisation & D3Robin Hawkes
 
ViziCities: Making SimCity for the Real World
ViziCities: Making SimCity for the Real WorldViziCities: Making SimCity for the Real World
ViziCities: Making SimCity for the Real WorldRobin Hawkes
 
The State of WebRTC
The State of WebRTCThe State of WebRTC
The State of WebRTCRobin Hawkes
 
Bringing Cities to Life Using Big Data & WebGL
Bringing Cities to Life Using Big Data & WebGLBringing Cities to Life Using Big Data & WebGL
Bringing Cities to Life Using Big Data & WebGLRobin Hawkes
 
Mobile App Development - Pitfalls & Helpers
Mobile App Development - Pitfalls & HelpersMobile App Development - Pitfalls & Helpers
Mobile App Development - Pitfalls & HelpersRobin Hawkes
 
The State of HTML5 Games - Fluent JS
The State of HTML5 Games - Fluent JSThe State of HTML5 Games - Fluent JS
The State of HTML5 Games - Fluent JSRobin Hawkes
 
HTML5 Technologies for Game Development - Web Directions Code
HTML5 Technologies for Game Development - Web Directions CodeHTML5 Technologies for Game Development - Web Directions Code
HTML5 Technologies for Game Development - Web Directions CodeRobin Hawkes
 
MelbJS - Inside Rawkets
MelbJS - Inside RawketsMelbJS - Inside Rawkets
MelbJS - Inside RawketsRobin Hawkes
 
MDN Hackday London - Open Web Games with HTML5 & JavaScript
MDN Hackday London - Open Web Games with HTML5 & JavaScriptMDN Hackday London - Open Web Games with HTML5 & JavaScript
MDN Hackday London - Open Web Games with HTML5 & JavaScriptRobin Hawkes
 
HTML5 Games - Not Just for Gamers
HTML5 Games - Not Just for GamersHTML5 Games - Not Just for Gamers
HTML5 Games - Not Just for GamersRobin Hawkes
 
NY HTML5 - Game Development with HTML5 & JavaScript
NY HTML5 - Game Development with HTML5 & JavaScriptNY HTML5 - Game Development with HTML5 & JavaScript
NY HTML5 - Game Development with HTML5 & JavaScriptRobin Hawkes
 
Open Web Games with HTML5 & JavaScript
Open Web Games with HTML5 & JavaScriptOpen Web Games with HTML5 & JavaScript
Open Web Games with HTML5 & JavaScriptRobin Hawkes
 
Open Web Games with HTML5 & JavaScript
Open Web Games with HTML5 & JavaScriptOpen Web Games with HTML5 & JavaScript
Open Web Games with HTML5 & JavaScriptRobin Hawkes
 
Open Web Games using HTML5 & JavaScript
Open Web Games using HTML5 & JavaScriptOpen Web Games using HTML5 & JavaScript
Open Web Games using HTML5 & JavaScriptRobin Hawkes
 

Plus de Robin Hawkes (19)

ViziCities - Lessons Learnt Visualising Real-world Cities in 3D
ViziCities - Lessons Learnt Visualising Real-world Cities in 3DViziCities - Lessons Learnt Visualising Real-world Cities in 3D
ViziCities - Lessons Learnt Visualising Real-world Cities in 3D
 
Calculating building heights using a phone camera
Calculating building heights using a phone cameraCalculating building heights using a phone camera
Calculating building heights using a phone camera
 
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big DataWebVisions – ViziCities: Bringing Cities to Life Using Big Data
WebVisions – ViziCities: Bringing Cities to Life Using Big Data
 
Understanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisationUnderstanding cities using ViziCities and 3D data visualisation
Understanding cities using ViziCities and 3D data visualisation
 
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGLViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
ViziCities: Creating Real-World Cities in 3D using OpenStreetMap and WebGL
 
Beautiful Data Visualisation & D3
Beautiful Data Visualisation & D3Beautiful Data Visualisation & D3
Beautiful Data Visualisation & D3
 
ViziCities: Making SimCity for the Real World
ViziCities: Making SimCity for the Real WorldViziCities: Making SimCity for the Real World
ViziCities: Making SimCity for the Real World
 
The State of WebRTC
The State of WebRTCThe State of WebRTC
The State of WebRTC
 
Bringing Cities to Life Using Big Data & WebGL
Bringing Cities to Life Using Big Data & WebGLBringing Cities to Life Using Big Data & WebGL
Bringing Cities to Life Using Big Data & WebGL
 
Mobile App Development - Pitfalls & Helpers
Mobile App Development - Pitfalls & HelpersMobile App Development - Pitfalls & Helpers
Mobile App Development - Pitfalls & Helpers
 
The State of HTML5 Games - Fluent JS
The State of HTML5 Games - Fluent JSThe State of HTML5 Games - Fluent JS
The State of HTML5 Games - Fluent JS
 
HTML5 Technologies for Game Development - Web Directions Code
HTML5 Technologies for Game Development - Web Directions CodeHTML5 Technologies for Game Development - Web Directions Code
HTML5 Technologies for Game Development - Web Directions Code
 
MelbJS - Inside Rawkets
MelbJS - Inside RawketsMelbJS - Inside Rawkets
MelbJS - Inside Rawkets
 
MDN Hackday London - Open Web Games with HTML5 & JavaScript
MDN Hackday London - Open Web Games with HTML5 & JavaScriptMDN Hackday London - Open Web Games with HTML5 & JavaScript
MDN Hackday London - Open Web Games with HTML5 & JavaScript
 
HTML5 Games - Not Just for Gamers
HTML5 Games - Not Just for GamersHTML5 Games - Not Just for Gamers
HTML5 Games - Not Just for Gamers
 
NY HTML5 - Game Development with HTML5 & JavaScript
NY HTML5 - Game Development with HTML5 & JavaScriptNY HTML5 - Game Development with HTML5 & JavaScript
NY HTML5 - Game Development with HTML5 & JavaScript
 
Open Web Games with HTML5 & JavaScript
Open Web Games with HTML5 & JavaScriptOpen Web Games with HTML5 & JavaScript
Open Web Games with HTML5 & JavaScript
 
Open Web Games with HTML5 & JavaScript
Open Web Games with HTML5 & JavaScriptOpen Web Games with HTML5 & JavaScript
Open Web Games with HTML5 & JavaScript
 
Open Web Games using HTML5 & JavaScript
Open Web Games using HTML5 & JavaScriptOpen Web Games using HTML5 & JavaScript
Open Web Games using HTML5 & JavaScript
 

Dernier

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 Processorsdebabhi2
 
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 organizationRadu Cotescu
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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...Martijn de Jong
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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 SolutionsEnterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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...Neo4j
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Dernier (20)

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
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Hacking with B2G – Web Apps and Customisation

  • 1. 2G H onB IT ati W mis G IN d custo es CK an bH aw k A pps H ba Ro We Hi, I’m Rob Hawkes and this is a little intro to hacking around with Boot to Gecko.
  • 2. B2G Gaia B2G is actually two separate things; B2G and Gaia The B2G side is the hardware-related stuff and JavaScript APIs that we need to make the phone work. The B2G side is pretty much everything that you don’t see.
  • 3. Gaia is the stuff you can see and the things you can interact with. Although you can hack around with and help with the core Boot to Gecko functionality, you’ll probably be most interested in the front-end Gaia operating system and the Web apps that can be created for it.
  • 4. a y d to ns 2 G tio g B op sin are a f ew U he re T There are a 2 main options to start using and playing with B2G this evening.
  • 5. If you have some knowledge of git, you can clone the Gaia repository and launch Gaia using a recent Firefox Nightly build. Pros:  - No build system  and very little setup required - Can use the Firefox dev tools Cons: - The viewport is based on the size of the browser window - Many device-like things won't work - Apps are launched in separate, pinned tabs - Firefox Nightly might be unstable http://nightly.mozilla.org https://github.com/andreasgal/gaia/
  • 6. There is also gaia-devserver, a node-based tool for developing Gaia in Firefox Nightly. https://github.com/jrburke/gaia-devserver
  • 7. Gaia in Nightly You’ll have to resize the browser to get it looking right but it’s a great way to quickly play with Gaia and start developing apps for it.
  • 8. B2G Device The other option is to use one of the 3 B2G devices that I’ve brought along this evening. https://developer.mozilla.org/en/Mozilla/Boot_to_Gecko#Setting_up_. 26_building_Boot_to_Gecko
  • 9. p s Ap W eb Gecko pen r Boot to O ps fo ap ng ati Cre Open Web Apps is an initiative that is core to B2G and one that is important to the Web as a whole. It’s a way of creating and distributing apps that puts the developers and users of apps back in charge. It’s a way that embraces open technology and is for the good of the Web.
  • 10. te d r ta app g s ttin te an Ge to crea How Creating a Web app isn’t crazy hard, it’s just a case of understanding the new features in browsers. https://developer.mozilla.org/en/Apps
  • 11. tes bsi we olo gy ar e tec hn ps me Ap et he sa us ey Th Apps are websites and are built using the same technology and processes. If you already know how to make a website then creating your first Web app is a breeze.
  • 12. fe st n i a m o an a pp io n int a t ite plic we bs Ap rninga Tu The only thing that you need to do to turn a website into app is create an application manifest.
  • 13. { "version": "1.0", "name": "MozillaBall", "description": "Exciting Open Web development action!", "icons": { "16": "/img/icon-16.png", "48": "/img/icon-48.png", "128": "/img/icon-128.png" }, "developer": { "name": "Mozilla Labs", "url": "http://mozillalabs.com" }, "installs_allowed_from": [ "https://appstore.mozillalabs.com" ], "default_locale": "en" } This is a JSON file that effectively describes your application; it’s name, icons, and other related data.
  • 14. nts e irem ember q u t re ttor em fes tan ni mp or Ma I There are a couple of important things to remember when creating an application manifest.
  • 15. a in o m ty e d curi am nt of se S me ele An The first is that it needs to be hosted from the same domain as your Web app. This is pretty straightforward and it adds an element of security in that it is unlikely that a rouge manifest file will be able to be put on the same domain without your knowledge.
  • 16. Content-type header application/x-web-app-manifest+json The second is that it needs to be served with a specific content type (application/x-web-app- manifest+json). This is probably the most tricky process in turning a website into an app as it involves changing settings on your server or a bit of hackery in your manifest file. If you don’t want to fiddle with your server then you can always set the content-type header using something like PHP or Node.js.
  • 17. to r a lid s ok va st hin g i nife everyt Ma su re king Ma If you want to make sure your manifest is valid you can have it checked at http:// appmanifest.org
  • 18. p s a p lin g ce tal etp la Ins rM ark sero brow the gh hrou T You can install apps in B2G through the browser or the Mozilla Marketplace. You can also install apps on the desktop and Android using Firefox.
  • 19. Installing an app navigator.mozApps.install(manifestUrl) Behind the scenes, installing an app is achieved through the new mozApps JavaScript API. By passing the ‘install’ method a string URL to the app’s manifest file you will trigger the installation process. An example of when you would call this method is after a user clicks on an “Install this app” button on your own website. It would be called automatically if your app was installed from the Mozilla Marketplace, or any other external website.
  • 20. The install method triggers an installation dialogue within the browser that allows the user to decide what to do with the app. On Windows, a desktop shortcut is created for the app you installed and it will also be in the start menu. On Mac, the app is added to your /Applications directory. On B2G, the app is added to your homescreen.
  • 21. ery a ck ce ia h de vi Ga ot he ak st e tw nd sa pp ga hin Pus The 3 devices that I’ve brought along for you today are already set up ready to have applications pushed to them and things tweaked. To do that you’ll need to plug the device into your computer and directly push updates to it. This approach is useful for development as it allows you to quickly test things without having to upload the app to the Web and installing or updating it from there. https://wiki.mozilla.org/B2G/DeveloperPhone#Advanced_Gaia_Hacking
  • 22. The first thing you need is the Android Debug Bridge. This allows you to communicate between your computer and the B2G device via a USB cable. http://developer.android.com/sdk/index.html
  • 23. Dev installation https://github.com/andreasgal/gaia/ The next step, if you haven’t got it already, is to download Gaia from GitHub. The very latest version may be unstable so it’s recommended to use the build that we’ve brought along and can provide you on a memory stick. https://github.com/andreasgal/gaia/
  • 24. Dev installation Add app to ‘../gaia/apps/myapp’ Once you have Gaia then add or create your application in the ‘../gaia/apps/myapp’ directory. Make sure to include the application manifest file.
  • 25. Dev installation make install-gaia The last step is to push your app and any Gaia updates to the device. That’s it!
  • 26. io n ta t en ne ed cum ty ou Do gt ha thin ery Ev Here are a few of the key places to go for documentation about developing on B2G and Open Web Apps.
  • 27. Boot to Gecko MDN documentation https://developer.mozilla.org/en/Mozilla/Boot_to_Gecko
  • 29. Open Web Apps documentation https://developer.mozilla.org/en/Apps
  • 30. ge s n lle jects cha ro ack ssiblep H nd po easa Id There are a few specific challenges that you might want to consider tonight.
  • 31. p p b a We xis ts e a ad ye at lre Cre ortha ta w ne thing e Som Create a Web app
  • 32. aia e G is m or fea ture sto yle Cu st new a ate Cre Customise Gaia by creating a new style or feature
  • 33. u e iss aia tch a G it a pa Fix su bm nd ea on Grab Fix a Gaia issue from GitHub and submit a patch.
  • 34. Rob Hawkes @robhawkes Rawkes.com Personal website and blog RECENT PROJECTS MORE COOL STUFF Twitter sentiment analysis Rawket Scientist Delving into your soul Technical Evangelist at Mozilla Rawkets.com Slides HTML5 & WebSockets game slideshare.net/robhawkes Get in touch with me on Twitter: @robhawkes Follow my blog (Rawkes) to keep up to date with stuff that I’m working on: http:// rawkes.com I’ve recently worked on a project that analyses sentiment on Twitter: http://rawkes.com/ blog/2011/05/05/people-love-a-good-smooch-on-a-balcony Rawkets is my multiplayer HTML5 and JavaScript game. Play it, it’s fun: http://rawkets.com These slides are online at slideshare.net/robhawkes