SlideShare une entreprise Scribd logo
1  sur  56
Télécharger pour lire hors ligne
How Do I Code Thee?
Let Me Count The Ways.
Dan Morrill
Google Developer Relations
What is Android?
The Layer Cake

                                         Applications
                  Home                Contacts             Phone               Browser

                             Application Framework
                  Activity              Window              Content              View

        Package              Telephony           Resource             Location            GTalk

                      Libraries                                    Android Runtime
        Surface               Media               SQLite                         Core

       OpenGL |              FreeType            WebKit                          Dalvik

         SGL                   SSL                 libc

                                         Linux Kernel
        Display              Camera              Bluetooth             Flash              Binder

         USB                  Keypad               WiFi                Audio              Power




         4
What is Android?
A chunk of code for making phone calls




6   Image by Evi Christodoulou; http://www.flickr.com/search/?q=startac&l=comm&ct=0
    Licensed under Creative Commons Attribution-Share Alike
A robust network stack and Internet client




7
A Platform for Running Code




8   Image by sludgegulper; http://www.flickr.com/photos/sludgeulper/3441498831/
    Licensed under Creative Commons Attribution-Share Alike
A Platform for Running Code
• Android has an application platform, true
• But we didn’t create Android in an attempt to “own mobile”
• Android is a framework for interacting components
    – Apps can pull in pieces of other apps, the web, or even native




9       Image by genvessel; http://www.flickr.com/photos/genvessel/177133869/
        Licensed under Creative Commons Attribution
"Give me your compiled, your ARM, your huddled
      bytecodes yearning to run free, the wretched refuse of
     your teeming store. Send these, the threadless, scripted
        stuff to me, I lift my lamp beside the coder’s door."
10
Agenda
• Introduce the Three Kinds
• Demonstrate how to use them
• Useful comparisons & statistics
• Future directions




11
Anti-Agenda
• I will not...
     – Teach you how to write apps
     – Rehash stuff that’s covered elsewhere
     – Pass judgment




12
Three Delicious Flavors
The (current) Three Kinds of Android Code
• Managed Code
• Ajax
• Native Code




14   Images by Sharon Mollerus (http://www.flickr.com/photos/clairity/3229586543/) and Gemma Vittoria (http://www.flickr.com/photos/ggvic/3255129747/)
     Licensed under Creative Commons Attribution
Dalvik Code
Wait Wait, Hold Up
I Need a Victim
• Interesting but computationally significant
• Efficiently externalizable
• Must make for an interesting visualization




17
How about.... k-means clustering?
• Used to identify clusters in sets of points
• We’ll use a simple 2D version
     – 500 randomly-generated points
     – 6 clusters (ROYGBV)
• Easy to visualize on screen
• 3 implementations
     – “Pure” Dalvik app (i.e. 100% Java source code)
     – Same visualization code with C algorithm implementation
     – JavaScript




18
K-Means Clustering in 2,000 Words




     Source: http://en.wikipedia.org/wiki/K-means_clustering


19
Dalvik Code
Dalvik - Overview
• Dalvik is a virtual machine, similar to the JVM or .Net CLR
• Memory-protected, garbage-collected, & lifecycle-managed
• Optimized for embedded machines
     – Built to reduce much of the need for a JITC
• Custom bytecode format; included translator from Java bytecode




21       Image by damon brunson; http://www.flickr.com/photos/blackdudemedia/2495758057/
         Licensed under Creative Commons Attribution
Dalvik - Writing Apps
• Apps run on Dalvik, which provides core framework APIs
• APIs are backed by system infrastructure in native code
     – e.g. OpenGL, Binder IPC, media, etc.
• Popular tools are supported, and an Eclipse plugin is available




22
Dalvik - What Can You Do?
• Rich UIs
• Background services
• Shared components
• Tight integration with system events and UI
• ...but there are other sessions covering standard app dev in detail




23    Image by Jennifer Rensel; http://www.flickr.com/photos/cheesepicklescheese/419050330/
      Licensed under Creative Commons Attribution
Dalvik - What Can’t You Do?
• Not much!
• Dalvik is the primary app platform --
 the crossroads
• That does not necessarily mean it’s
 right for your app, though
     – Some apps need raw speed
     – Some apps don’t need tight
      integration




24       Image by Captain DJ; http://www.flickr.com/photos/darrinjonz/117406669/
         Licensed under Creative Commons Attribution-Share Alike
Dalvik - Demo
Dalvik - Examples
• Core system apps
• Currently (nearly) all apps on the Android Market




26
Dalvik - Future
• Improved (faster, better) garbage collection
• Just-In-Time compilation
• Optimizations in core libraries
• Additional APIs -- Bluetooth, P2P, and more




27   Image by the Seattle Municipal Archives; http://www.flickr.com/photos/seattlemunicipalarchives/2680241972/
     Licensed under Creative Commons Attribution
Ajax (Web) Apps
Ajax - Overview
• Apps are broken up into convenient declarative layouts & code
• JavaScript code mutates the DOM to create UI effects
• Network access is available via XMLHttpRequest
• Recently, <canvas> allows JavaScript to do direct painting




29   Image by henrybloomfield; http://www.flickr.com/photos/henrybloomfield/2929756532/
     Licensed under Creative Commons Attribution-No Derivative Works
Ajax on Android - Overview
• Android’s Browser is based on WebKit + SquirrelFish
• WebKit v528.5, equivalent to Safari 4 beta
     – Reports as 3.1.2 in the user-agent string -- oops!
• Includes Gears 0.5.17.0 (including location)
• Includes support for the <canvas> tag




30
Ajax - What Can You Do?
• Old sk00l
     – You can, of course, just build static web page apps




31       Image by Jason Rogers; http://www.flickr.com/photos/restlessglobetrotter/434218278/
         Licensed under Creative Commons Attribution
Ajax - What Can You Do?
• But you can also build dynamic UIs, via DOM or <canvas>
• You can fetch & store data on your origin server
• With HTML5, you can also:
     – Access location
     – Run code outside the main thread
     – Store data & pages locally




32
Ajax on Android - What Can’t You Do?
• Android doesn’t currently support HTML5, but does have Gears
• Background processing
     – Code only runs when Browser is open and your page is loaded
• Access system & framework APIs [1]




 [1] - Hold that thought, though.



33
Ajax - Demo
Ajax - Examples
• Google Reader for mobile
• Gmail (web version)
• Many mobile web apps (of various fruit flavors)




35
Ajax - Future
• HTML5 will keep getting better
• Android will continue to include a world-class browser
     – Gears today, HTML5 in the future
     – Plans to upgrade to an even faster JSVM
• Who knows what else? I hear the future is a crazy place




36
Ajax - What Else Can You Do?
  • Augmented Ajax


   Java              Java                     Java
   Object            Object                   Object




            addJavaScriptInterface
Dalvik




            WebView

     37     Image by Luis Villa del Campo; http://www.flickr.com/photos/maguisso/271623867/
            Licensed under Creative Commons Attribution
Augmented Ajax
• Inject functionality into JavaScript




38    Image by Andres Lueda Lopez; http://www.flickr.com/photos/andresrueda/2983149263/
      Licensed under Creative Commons Attribution-No Derivative Works
Native Code
Native - Overview
• Launched as a Dalvik application
• Loads a dynamic library (.so, ARM ELF, linked against Bionic)
• Makes calls into native code via JNI for heavy lifting
• .so files are created using the NDK complement to the SDK
• Work-in-progress NDK added to donut branch in git




40   Image by Thomas; http://www.flickr.com/photos/tomsaint/2678120228/
     Licensed under Creative Commons Attribution
Native - What Can You Do?
• Physics simulations
• Efficient/fast loading of large-ish data files
• Speed-intensive lookups, such as for IMEs
• Custom VMs (long live obsolete games!)
• Unsupported things...
     – Technically, other libraries are present, but have no guarantees
     – Use them, and you deserve the Market user ratings you will get
      when your app breaks




41
Native - What Can’t You Do?
• Current set of APIs is limited to libm and libc
• More will be added over time
• h@x0r the system -- sandboxing still applies




42
Native - Demo
Native - Examples
• SCUMMVM
• Spotify
• Much of the system, actually...




44
Native - Future
• Add additional libraries, but which? TBD.
  – Let us know!
• No plans to make native code a fully-independent app model
  – ...but there’s no reason to prevent developers from doing stuff




45
Bonus Demo
How Do You Choose?
Some Data

                        Rendering    Percent
     Modality   Total     Time      Rendering

      Dalvik    614        16         2.6%


 JavaScript     936        303       32.4%


     Native     127        15        11.2%




48
Some Data

                        Rendering    Percent
     Modality   Total     Time      Rendering

      Dalvik    614        16         2.6%


 JavaScript     936        303       32.4%


     Native     127        15        11.2%




49
Some Data

                        Rendering    Percent
     Modality   Total     Time      Rendering

      Dalvik    614        16         2.6%


 JavaScript     936        303       32.4%


     Native     127        15        11.2%




50
What’s that mean?
• Dalvik is very competitive with other pure-interpreted VMs
• Dalvik, as a front-end for native code, usually beats JavaScript
 – But clearly, there are use cases where that doesn’t matter
• And of course, custom native code will always win the speed test




51
Groundbreaking, Dynamo-Interactive Flowchart

    Do you                                       Why not?
   have an                Is it                 You should
                                                                                       Java
 existing web            Ajax?                  go make it        C/C++
     site?                                        Ajaxy.




                                                                                  JavaScript
      Do                      Haven’t we been
   you need             REST here before?
    a web              Service                                     Hey,
     site?                                                         what

                                          Ugh, I               languages do
                                                                 you even
                                                                  know?
                                         have a
     Does
   your app
need to be really
                      Seriously,
                     now. Really
                                        headache.
                                             Okay
                                             fine,
     fast?            REALLY                     Native
                        fast?

                                                                              Augmented
                                                                                 Ajax
                         Hmm,
                      hold on. Do
      Ajax           you need tight             Yeah, that’s
                                                                  Dalvik
                    integration with              what I
                        system?                  thought.
       52
The Bottom Line
• There’s more than one way to do it
• We aren’t out to shove a paradigm down your throat (ouch?)




53   Image by i_yudai; http://www.flickr.com/photos/y_i/2330044065/
     Licensed under Creative Commons Attribution
The Bottom Line
• The “centroid” of your app can be anywhere
  – Dalvik apps can embed the web; web apps can call to Dalvik
  – Apps can include native code pieces for better performance
• Understand your app, & decide based on your app’s needs
  – If you’re doing lots of drawing, use Dalvik
  – If you have a web presence already, use (Dalvik-enhanced?) Ajax
  – If you have large, slow algorithms, use Dalvik + native code
  – Your skills do mean something: go with what you know!




54
And That’s Pretty Much The Long and Short of It




     Source available at: http://code.google.com/p/hdict

55      Image by Alexander Henning Drachmann; http://www.flickr.com/photos/drachmann/327122302/
        Licensed under Creative Commons Attribution-Share Alike
Android : How Do I Code Thee?

Contenu connexe

Tendances

Update from android kk to android l
Update from android kk to android lUpdate from android kk to android l
Update from android kk to android lBin Yang
 
Android for Java Developers at OSCON 2010
Android for Java Developers at OSCON 2010Android for Java Developers at OSCON 2010
Android for Java Developers at OSCON 2010Marko Gargenta
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions newJoe Jacob
 
Android For Managers Slides
Android For Managers SlidesAndroid For Managers Slides
Android For Managers SlidesMarko Gargenta
 
.docker : how to deploy Digital Experience in a container drinking a cup of c...
.docker : how to deploy Digital Experience in a container drinking a cup of c....docker : how to deploy Digital Experience in a container drinking a cup of c...
.docker : how to deploy Digital Experience in a container drinking a cup of c...Andrea Fontana
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To AndroidGoogleTecTalks
 
Marakana Android Internals
Marakana Android InternalsMarakana Android Internals
Marakana Android InternalsMarko Gargenta
 
Android: A 9,000-foot Overview
Android: A 9,000-foot OverviewAndroid: A 9,000-foot Overview
Android: A 9,000-foot OverviewMarko Gargenta
 
Container as a Service with Docker
Container as a Service with DockerContainer as a Service with Docker
Container as a Service with DockerPatrick Chanezon
 
Reproducibility in artificial intelligence
Reproducibility in artificial intelligenceReproducibility in artificial intelligence
Reproducibility in artificial intelligenceCarlos Toxtli
 
Containers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshellContainers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshellEugene Fedorenko
 
Containers in depth – Understanding how containers work to better work with c...
Containers in depth – Understanding how containers work to better work with c...Containers in depth – Understanding how containers work to better work with c...
Containers in depth – Understanding how containers work to better work with c...All Things Open
 
Alibaba Cloud Conference 2016 - Docker Open Source
Alibaba Cloud Conference   2016 - Docker Open Source Alibaba Cloud Conference   2016 - Docker Open Source
Alibaba Cloud Conference 2016 - Docker Open Source John Willis
 
Autom editor video blooper recognition and localization for automatic monolo...
Autom editor  video blooper recognition and localization for automatic monolo...Autom editor  video blooper recognition and localization for automatic monolo...
Autom editor video blooper recognition and localization for automatic monolo...Carlos Toxtli
 
Docker, how to use it. organize a meeting with IBM products...
Docker, how to use it. organize a meeting with IBM products...Docker, how to use it. organize a meeting with IBM products...
Docker, how to use it. organize a meeting with IBM products...Andrea Fontana
 

Tendances (19)

Update from android kk to android l
Update from android kk to android lUpdate from android kk to android l
Update from android kk to android l
 
Android for Java Developers at OSCON 2010
Android for Java Developers at OSCON 2010Android for Java Developers at OSCON 2010
Android for Java Developers at OSCON 2010
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
 
Open Android
Open AndroidOpen Android
Open Android
 
Android For Managers Slides
Android For Managers SlidesAndroid For Managers Slides
Android For Managers Slides
 
.docker : how to deploy Digital Experience in a container drinking a cup of c...
.docker : how to deploy Digital Experience in a container drinking a cup of c....docker : how to deploy Digital Experience in a container drinking a cup of c...
.docker : how to deploy Digital Experience in a container drinking a cup of c...
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
Marakana Android Internals
Marakana Android InternalsMarakana Android Internals
Marakana Android Internals
 
Android: A 9,000-foot Overview
Android: A 9,000-foot OverviewAndroid: A 9,000-foot Overview
Android: A 9,000-foot Overview
 
Container as a Service with Docker
Container as a Service with DockerContainer as a Service with Docker
Container as a Service with Docker
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Reproducibility in artificial intelligence
Reproducibility in artificial intelligenceReproducibility in artificial intelligence
Reproducibility in artificial intelligence
 
Containers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshellContainers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshell
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Containers in depth – Understanding how containers work to better work with c...
Containers in depth – Understanding how containers work to better work with c...Containers in depth – Understanding how containers work to better work with c...
Containers in depth – Understanding how containers work to better work with c...
 
Alibaba Cloud Conference 2016 - Docker Open Source
Alibaba Cloud Conference   2016 - Docker Open Source Alibaba Cloud Conference   2016 - Docker Open Source
Alibaba Cloud Conference 2016 - Docker Open Source
 
Autom editor video blooper recognition and localization for automatic monolo...
Autom editor  video blooper recognition and localization for automatic monolo...Autom editor  video blooper recognition and localization for automatic monolo...
Autom editor video blooper recognition and localization for automatic monolo...
 
Android quick talk
Android quick talkAndroid quick talk
Android quick talk
 
Docker, how to use it. organize a meeting with IBM products...
Docker, how to use it. organize a meeting with IBM products...Docker, how to use it. organize a meeting with IBM products...
Docker, how to use it. organize a meeting with IBM products...
 

En vedette

RetroFit by Square - GDG Dallas 06/09/16
RetroFit by Square - GDG Dallas 06/09/16RetroFit by Square - GDG Dallas 06/09/16
RetroFit by Square - GDG Dallas 06/09/16Stacy Devino
 
GKAC 2015 Apr. - Xamarin forms, mvvm and testing
GKAC 2015 Apr. - Xamarin forms, mvvm and testingGKAC 2015 Apr. - Xamarin forms, mvvm and testing
GKAC 2015 Apr. - Xamarin forms, mvvm and testingGDG Korea
 
GKAC 2015 Apr. - Android Looper
GKAC 2015 Apr. - Android LooperGKAC 2015 Apr. - Android Looper
GKAC 2015 Apr. - Android LooperGDG Korea
 
Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices
Java Micro Edition Platform & Android - Seminar on Small and Mobile DevicesJava Micro Edition Platform & Android - Seminar on Small and Mobile Devices
Java Micro Edition Platform & Android - Seminar on Small and Mobile Devicesjuricde
 
Intro to Android : Making your first App!
Intro to Android : Making your first App!Intro to Android : Making your first App!
Intro to Android : Making your first App!Stacy Devino
 
Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Stacy Devino
 
GKAC 2015 Apr. - Battery, 안드로이드를 위한 쉬운 웹 API 호출
GKAC 2015 Apr. - Battery, 안드로이드를 위한 쉬운 웹 API 호출GKAC 2015 Apr. - Battery, 안드로이드를 위한 쉬운 웹 API 호출
GKAC 2015 Apr. - Battery, 안드로이드를 위한 쉬운 웹 API 호출GDG Korea
 
같은 유저수, 다른 수익? 모바일 앱의 수익을 높이는 방법
같은 유저수, 다른 수익? 모바일 앱의 수익을 높이는 방법같은 유저수, 다른 수익? 모바일 앱의 수익을 높이는 방법
같은 유저수, 다른 수익? 모바일 앱의 수익을 높이는 방법GDG Korea
 
디자이너 없어도 괜찮아! (feat.Material Design Guide)
디자이너 없어도 괜찮아! (feat.Material Design Guide)디자이너 없어도 괜찮아! (feat.Material Design Guide)
디자이너 없어도 괜찮아! (feat.Material Design Guide)GDG Korea
 
GKAC 2014 Nov. - Android Wear 개발, 할까요 말까요?
GKAC 2014 Nov. - Android Wear 개발, 할까요 말까요?GKAC 2014 Nov. - Android Wear 개발, 할까요 말까요?
GKAC 2014 Nov. - Android Wear 개발, 할까요 말까요?GDG Korea
 
GKAC 2015 Apr. - RxAndroid
GKAC 2015 Apr. - RxAndroidGKAC 2015 Apr. - RxAndroid
GKAC 2015 Apr. - RxAndroidGDG Korea
 
GKAC 2014 Nov. - RxJava를 활용한 Functional Reactive Programming
GKAC 2014 Nov. - RxJava를 활용한 Functional Reactive ProgrammingGKAC 2014 Nov. - RxJava를 활용한 Functional Reactive Programming
GKAC 2014 Nov. - RxJava를 활용한 Functional Reactive ProgrammingGDG Korea
 
GKAC 2015 Apr. - 테스트 코드에서 코드 커버리지까지
GKAC 2015 Apr. - 테스트 코드에서 코드 커버리지까지GKAC 2015 Apr. - 테스트 코드에서 코드 커버리지까지
GKAC 2015 Apr. - 테스트 코드에서 코드 커버리지까지GDG Korea
 
Best Practices in Media Playback
Best Practices in Media PlaybackBest Practices in Media Playback
Best Practices in Media PlaybackGDG Korea
 
FIrebase를 이용한 호우호우 미니게임 만들기
FIrebase를 이용한 호우호우 미니게임 만들기FIrebase를 이용한 호우호우 미니게임 만들기
FIrebase를 이용한 호우호우 미니게임 만들기GDG Korea
 
Reinfocement learning
Reinfocement learningReinfocement learning
Reinfocement learningGDG Korea
 
안드로이드 데이터 바인딩
안드로이드 데이터 바인딩안드로이드 데이터 바인딩
안드로이드 데이터 바인딩GDG Korea
 
Introduce Android TV and new features from Google I/O 2016
Introduce Android TV and new features from Google I/O 2016Introduce Android TV and new features from Google I/O 2016
Introduce Android TV and new features from Google I/O 2016GDG Korea
 
Android - Preventing common memory leaks
Android - Preventing common memory leaksAndroid - Preventing common memory leaks
Android - Preventing common memory leaksAli Muzaffar
 
Diversity-aware search for people, content, events AND Diversity-aware hiring...
Diversity-aware search for people, content, events AND Diversity-aware hiring...Diversity-aware search for people, content, events AND Diversity-aware hiring...
Diversity-aware search for people, content, events AND Diversity-aware hiring...Aliaksandr Birukou
 

En vedette (20)

RetroFit by Square - GDG Dallas 06/09/16
RetroFit by Square - GDG Dallas 06/09/16RetroFit by Square - GDG Dallas 06/09/16
RetroFit by Square - GDG Dallas 06/09/16
 
GKAC 2015 Apr. - Xamarin forms, mvvm and testing
GKAC 2015 Apr. - Xamarin forms, mvvm and testingGKAC 2015 Apr. - Xamarin forms, mvvm and testing
GKAC 2015 Apr. - Xamarin forms, mvvm and testing
 
GKAC 2015 Apr. - Android Looper
GKAC 2015 Apr. - Android LooperGKAC 2015 Apr. - Android Looper
GKAC 2015 Apr. - Android Looper
 
Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices
Java Micro Edition Platform & Android - Seminar on Small and Mobile DevicesJava Micro Edition Platform & Android - Seminar on Small and Mobile Devices
Java Micro Edition Platform & Android - Seminar on Small and Mobile Devices
 
Intro to Android : Making your first App!
Intro to Android : Making your first App!Intro to Android : Making your first App!
Intro to Android : Making your first App!
 
Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!
 
GKAC 2015 Apr. - Battery, 안드로이드를 위한 쉬운 웹 API 호출
GKAC 2015 Apr. - Battery, 안드로이드를 위한 쉬운 웹 API 호출GKAC 2015 Apr. - Battery, 안드로이드를 위한 쉬운 웹 API 호출
GKAC 2015 Apr. - Battery, 안드로이드를 위한 쉬운 웹 API 호출
 
같은 유저수, 다른 수익? 모바일 앱의 수익을 높이는 방법
같은 유저수, 다른 수익? 모바일 앱의 수익을 높이는 방법같은 유저수, 다른 수익? 모바일 앱의 수익을 높이는 방법
같은 유저수, 다른 수익? 모바일 앱의 수익을 높이는 방법
 
디자이너 없어도 괜찮아! (feat.Material Design Guide)
디자이너 없어도 괜찮아! (feat.Material Design Guide)디자이너 없어도 괜찮아! (feat.Material Design Guide)
디자이너 없어도 괜찮아! (feat.Material Design Guide)
 
GKAC 2014 Nov. - Android Wear 개발, 할까요 말까요?
GKAC 2014 Nov. - Android Wear 개발, 할까요 말까요?GKAC 2014 Nov. - Android Wear 개발, 할까요 말까요?
GKAC 2014 Nov. - Android Wear 개발, 할까요 말까요?
 
GKAC 2015 Apr. - RxAndroid
GKAC 2015 Apr. - RxAndroidGKAC 2015 Apr. - RxAndroid
GKAC 2015 Apr. - RxAndroid
 
GKAC 2014 Nov. - RxJava를 활용한 Functional Reactive Programming
GKAC 2014 Nov. - RxJava를 활용한 Functional Reactive ProgrammingGKAC 2014 Nov. - RxJava를 활용한 Functional Reactive Programming
GKAC 2014 Nov. - RxJava를 활용한 Functional Reactive Programming
 
GKAC 2015 Apr. - 테스트 코드에서 코드 커버리지까지
GKAC 2015 Apr. - 테스트 코드에서 코드 커버리지까지GKAC 2015 Apr. - 테스트 코드에서 코드 커버리지까지
GKAC 2015 Apr. - 테스트 코드에서 코드 커버리지까지
 
Best Practices in Media Playback
Best Practices in Media PlaybackBest Practices in Media Playback
Best Practices in Media Playback
 
FIrebase를 이용한 호우호우 미니게임 만들기
FIrebase를 이용한 호우호우 미니게임 만들기FIrebase를 이용한 호우호우 미니게임 만들기
FIrebase를 이용한 호우호우 미니게임 만들기
 
Reinfocement learning
Reinfocement learningReinfocement learning
Reinfocement learning
 
안드로이드 데이터 바인딩
안드로이드 데이터 바인딩안드로이드 데이터 바인딩
안드로이드 데이터 바인딩
 
Introduce Android TV and new features from Google I/O 2016
Introduce Android TV and new features from Google I/O 2016Introduce Android TV and new features from Google I/O 2016
Introduce Android TV and new features from Google I/O 2016
 
Android - Preventing common memory leaks
Android - Preventing common memory leaksAndroid - Preventing common memory leaks
Android - Preventing common memory leaks
 
Diversity-aware search for people, content, events AND Diversity-aware hiring...
Diversity-aware search for people, content, events AND Diversity-aware hiring...Diversity-aware search for people, content, events AND Diversity-aware hiring...
Diversity-aware search for people, content, events AND Diversity-aware hiring...
 

Similaire à Android : How Do I Code Thee?

Crosswalk and the Intel XDK
Crosswalk and the Intel XDKCrosswalk and the Intel XDK
Crosswalk and the Intel XDKIntel® Software
 
Android operating system
Android operating systemAndroid operating system
Android operating systemDev Savalia
 
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...Codemotion
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013DuckMa
 
.NET? MonoDroid Does
.NET? MonoDroid Does.NET? MonoDroid Does
.NET? MonoDroid DoesKevin McMahon
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
 
Developing for BlackBerry 10 – Tools and SDKs by Luca Filigheddu
 Developing for BlackBerry 10 – Tools and SDKs by Luca Filigheddu Developing for BlackBerry 10 – Tools and SDKs by Luca Filigheddu
Developing for BlackBerry 10 – Tools and SDKs by Luca FilighedduCodemotion
 
Docker in Production: How RightScale Delivers Cloud Applications
Docker in Production: How RightScale Delivers Cloud ApplicationsDocker in Production: How RightScale Delivers Cloud Applications
Docker in Production: How RightScale Delivers Cloud ApplicationsRightScale
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015WaveMaker, Inc.
 
Announcing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAnnouncing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAmazon Web Services
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...IndicThreads
 

Similaire à Android : How Do I Code Thee? (20)

Crosswalk and the Intel XDK
Crosswalk and the Intel XDKCrosswalk and the Intel XDK
Crosswalk and the Intel XDK
 
Android operating system
Android operating systemAndroid operating system
Android operating system
 
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
QNX, C/C++, Qt, Cascades, HTML5… So what’s now BlackBerry 10 application deve...
 
My androidpresentation
My androidpresentationMy androidpresentation
My androidpresentation
 
Android Lollipop
Android LollipopAndroid Lollipop
Android Lollipop
 
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
Matteo Gazzurelli - Andorid introduction - Google Dev Fest 2013
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
.NET? MonoDroid Does
.NET? MonoDroid Does.NET? MonoDroid Does
.NET? MonoDroid Does
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
Developing for BlackBerry 10 – Tools and SDKs by Luca Filigheddu
 Developing for BlackBerry 10 – Tools and SDKs by Luca Filigheddu Developing for BlackBerry 10 – Tools and SDKs by Luca Filigheddu
Developing for BlackBerry 10 – Tools and SDKs by Luca Filigheddu
 
Transforming the web into a real application platform
Transforming the web into a real application platformTransforming the web into a real application platform
Transforming the web into a real application platform
 
Docker in Production: How RightScale Delivers Cloud Applications
Docker in Production: How RightScale Delivers Cloud ApplicationsDocker in Production: How RightScale Delivers Cloud Applications
Docker in Production: How RightScale Delivers Cloud Applications
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Lick my Lollipop
Lick my LollipopLick my Lollipop
Lick my Lollipop
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
 
Announcing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck TalksAnnouncing AWS CodeBuild - January 2017 Online Teck Talks
Announcing AWS CodeBuild - January 2017 Online Teck Talks
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...Mobile Web Applications using HTML5  [IndicThreads Mobile Application Develop...
Mobile Web Applications using HTML5 [IndicThreads Mobile Application Develop...
 
Nodejs overview
Nodejs overviewNodejs overview
Nodejs overview
 

Plus de Viswanath J

Introduction to Consul
Introduction to ConsulIntroduction to Consul
Introduction to ConsulViswanath J
 
Getting started with Cassandra 2.1
Getting started with Cassandra 2.1Getting started with Cassandra 2.1
Getting started with Cassandra 2.1Viswanath J
 
Introduction to NOSQL quadrants
Introduction to NOSQL quadrantsIntroduction to NOSQL quadrants
Introduction to NOSQL quadrantsViswanath J
 
Improving effectiveness of a meeting
Improving effectiveness of a meetingImproving effectiveness of a meeting
Improving effectiveness of a meetingViswanath J
 
Introduction To Docbook 4 .5 Authoring
Introduction To Docbook 4 .5   AuthoringIntroduction To Docbook 4 .5   Authoring
Introduction To Docbook 4 .5 AuthoringViswanath J
 

Plus de Viswanath J (6)

Introduction to Consul
Introduction to ConsulIntroduction to Consul
Introduction to Consul
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Getting started with Cassandra 2.1
Getting started with Cassandra 2.1Getting started with Cassandra 2.1
Getting started with Cassandra 2.1
 
Introduction to NOSQL quadrants
Introduction to NOSQL quadrantsIntroduction to NOSQL quadrants
Introduction to NOSQL quadrants
 
Improving effectiveness of a meeting
Improving effectiveness of a meetingImproving effectiveness of a meeting
Improving effectiveness of a meeting
 
Introduction To Docbook 4 .5 Authoring
Introduction To Docbook 4 .5   AuthoringIntroduction To Docbook 4 .5   Authoring
Introduction To Docbook 4 .5 Authoring
 

Dernier

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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.pptxHampshireHUG
 
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
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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 WorkerThousandEyes
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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 slidevu2urc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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.pdfEnterprise Knowledge
 
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
 
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
 

Dernier (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
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...
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
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
 

Android : How Do I Code Thee?

  • 1.
  • 2. How Do I Code Thee? Let Me Count The Ways. Dan Morrill Google Developer Relations
  • 4. The Layer Cake Applications Home Contacts Phone Browser Application Framework Activity Window Content View Package Telephony Resource Location GTalk Libraries Android Runtime Surface Media SQLite Core OpenGL | FreeType WebKit Dalvik SGL SSL libc Linux Kernel Display Camera Bluetooth Flash Binder USB Keypad WiFi Audio Power 4
  • 6. A chunk of code for making phone calls 6 Image by Evi Christodoulou; http://www.flickr.com/search/?q=startac&l=comm&ct=0 Licensed under Creative Commons Attribution-Share Alike
  • 7. A robust network stack and Internet client 7
  • 8. A Platform for Running Code 8 Image by sludgegulper; http://www.flickr.com/photos/sludgeulper/3441498831/ Licensed under Creative Commons Attribution-Share Alike
  • 9. A Platform for Running Code • Android has an application platform, true • But we didn’t create Android in an attempt to “own mobile” • Android is a framework for interacting components – Apps can pull in pieces of other apps, the web, or even native 9 Image by genvessel; http://www.flickr.com/photos/genvessel/177133869/ Licensed under Creative Commons Attribution
  • 10. "Give me your compiled, your ARM, your huddled bytecodes yearning to run free, the wretched refuse of your teeming store. Send these, the threadless, scripted stuff to me, I lift my lamp beside the coder’s door." 10
  • 11. Agenda • Introduce the Three Kinds • Demonstrate how to use them • Useful comparisons & statistics • Future directions 11
  • 12. Anti-Agenda • I will not... – Teach you how to write apps – Rehash stuff that’s covered elsewhere – Pass judgment 12
  • 14. The (current) Three Kinds of Android Code • Managed Code • Ajax • Native Code 14 Images by Sharon Mollerus (http://www.flickr.com/photos/clairity/3229586543/) and Gemma Vittoria (http://www.flickr.com/photos/ggvic/3255129747/) Licensed under Creative Commons Attribution
  • 17. I Need a Victim • Interesting but computationally significant • Efficiently externalizable • Must make for an interesting visualization 17
  • 18. How about.... k-means clustering? • Used to identify clusters in sets of points • We’ll use a simple 2D version – 500 randomly-generated points – 6 clusters (ROYGBV) • Easy to visualize on screen • 3 implementations – “Pure” Dalvik app (i.e. 100% Java source code) – Same visualization code with C algorithm implementation – JavaScript 18
  • 19. K-Means Clustering in 2,000 Words Source: http://en.wikipedia.org/wiki/K-means_clustering 19
  • 21. Dalvik - Overview • Dalvik is a virtual machine, similar to the JVM or .Net CLR • Memory-protected, garbage-collected, & lifecycle-managed • Optimized for embedded machines – Built to reduce much of the need for a JITC • Custom bytecode format; included translator from Java bytecode 21 Image by damon brunson; http://www.flickr.com/photos/blackdudemedia/2495758057/ Licensed under Creative Commons Attribution
  • 22. Dalvik - Writing Apps • Apps run on Dalvik, which provides core framework APIs • APIs are backed by system infrastructure in native code – e.g. OpenGL, Binder IPC, media, etc. • Popular tools are supported, and an Eclipse plugin is available 22
  • 23. Dalvik - What Can You Do? • Rich UIs • Background services • Shared components • Tight integration with system events and UI • ...but there are other sessions covering standard app dev in detail 23 Image by Jennifer Rensel; http://www.flickr.com/photos/cheesepicklescheese/419050330/ Licensed under Creative Commons Attribution
  • 24. Dalvik - What Can’t You Do? • Not much! • Dalvik is the primary app platform -- the crossroads • That does not necessarily mean it’s right for your app, though – Some apps need raw speed – Some apps don’t need tight integration 24 Image by Captain DJ; http://www.flickr.com/photos/darrinjonz/117406669/ Licensed under Creative Commons Attribution-Share Alike
  • 26. Dalvik - Examples • Core system apps • Currently (nearly) all apps on the Android Market 26
  • 27. Dalvik - Future • Improved (faster, better) garbage collection • Just-In-Time compilation • Optimizations in core libraries • Additional APIs -- Bluetooth, P2P, and more 27 Image by the Seattle Municipal Archives; http://www.flickr.com/photos/seattlemunicipalarchives/2680241972/ Licensed under Creative Commons Attribution
  • 29. Ajax - Overview • Apps are broken up into convenient declarative layouts & code • JavaScript code mutates the DOM to create UI effects • Network access is available via XMLHttpRequest • Recently, <canvas> allows JavaScript to do direct painting 29 Image by henrybloomfield; http://www.flickr.com/photos/henrybloomfield/2929756532/ Licensed under Creative Commons Attribution-No Derivative Works
  • 30. Ajax on Android - Overview • Android’s Browser is based on WebKit + SquirrelFish • WebKit v528.5, equivalent to Safari 4 beta – Reports as 3.1.2 in the user-agent string -- oops! • Includes Gears 0.5.17.0 (including location) • Includes support for the <canvas> tag 30
  • 31. Ajax - What Can You Do? • Old sk00l – You can, of course, just build static web page apps 31 Image by Jason Rogers; http://www.flickr.com/photos/restlessglobetrotter/434218278/ Licensed under Creative Commons Attribution
  • 32. Ajax - What Can You Do? • But you can also build dynamic UIs, via DOM or <canvas> • You can fetch & store data on your origin server • With HTML5, you can also: – Access location – Run code outside the main thread – Store data & pages locally 32
  • 33. Ajax on Android - What Can’t You Do? • Android doesn’t currently support HTML5, but does have Gears • Background processing – Code only runs when Browser is open and your page is loaded • Access system & framework APIs [1] [1] - Hold that thought, though. 33
  • 35. Ajax - Examples • Google Reader for mobile • Gmail (web version) • Many mobile web apps (of various fruit flavors) 35
  • 36. Ajax - Future • HTML5 will keep getting better • Android will continue to include a world-class browser – Gears today, HTML5 in the future – Plans to upgrade to an even faster JSVM • Who knows what else? I hear the future is a crazy place 36
  • 37. Ajax - What Else Can You Do? • Augmented Ajax Java Java Java Object Object Object addJavaScriptInterface Dalvik WebView 37 Image by Luis Villa del Campo; http://www.flickr.com/photos/maguisso/271623867/ Licensed under Creative Commons Attribution
  • 38. Augmented Ajax • Inject functionality into JavaScript 38 Image by Andres Lueda Lopez; http://www.flickr.com/photos/andresrueda/2983149263/ Licensed under Creative Commons Attribution-No Derivative Works
  • 40. Native - Overview • Launched as a Dalvik application • Loads a dynamic library (.so, ARM ELF, linked against Bionic) • Makes calls into native code via JNI for heavy lifting • .so files are created using the NDK complement to the SDK • Work-in-progress NDK added to donut branch in git 40 Image by Thomas; http://www.flickr.com/photos/tomsaint/2678120228/ Licensed under Creative Commons Attribution
  • 41. Native - What Can You Do? • Physics simulations • Efficient/fast loading of large-ish data files • Speed-intensive lookups, such as for IMEs • Custom VMs (long live obsolete games!) • Unsupported things... – Technically, other libraries are present, but have no guarantees – Use them, and you deserve the Market user ratings you will get when your app breaks 41
  • 42. Native - What Can’t You Do? • Current set of APIs is limited to libm and libc • More will be added over time • h@x0r the system -- sandboxing still applies 42
  • 44. Native - Examples • SCUMMVM • Spotify • Much of the system, actually... 44
  • 45. Native - Future • Add additional libraries, but which? TBD. – Let us know! • No plans to make native code a fully-independent app model – ...but there’s no reason to prevent developers from doing stuff 45
  • 47. How Do You Choose?
  • 48. Some Data Rendering Percent Modality Total Time Rendering Dalvik 614 16 2.6% JavaScript 936 303 32.4% Native 127 15 11.2% 48
  • 49. Some Data Rendering Percent Modality Total Time Rendering Dalvik 614 16 2.6% JavaScript 936 303 32.4% Native 127 15 11.2% 49
  • 50. Some Data Rendering Percent Modality Total Time Rendering Dalvik 614 16 2.6% JavaScript 936 303 32.4% Native 127 15 11.2% 50
  • 51. What’s that mean? • Dalvik is very competitive with other pure-interpreted VMs • Dalvik, as a front-end for native code, usually beats JavaScript – But clearly, there are use cases where that doesn’t matter • And of course, custom native code will always win the speed test 51
  • 52. Groundbreaking, Dynamo-Interactive Flowchart Do you Why not? have an Is it You should Java existing web Ajax? go make it C/C++ site? Ajaxy. JavaScript Do Haven’t we been you need REST here before? a web Service Hey, site? what Ugh, I languages do you even know? have a Does your app need to be really Seriously, now. Really headache. Okay fine, fast? REALLY Native fast? Augmented Ajax Hmm, hold on. Do Ajax you need tight Yeah, that’s Dalvik integration with what I system? thought. 52
  • 53. The Bottom Line • There’s more than one way to do it • We aren’t out to shove a paradigm down your throat (ouch?) 53 Image by i_yudai; http://www.flickr.com/photos/y_i/2330044065/ Licensed under Creative Commons Attribution
  • 54. The Bottom Line • The “centroid” of your app can be anywhere – Dalvik apps can embed the web; web apps can call to Dalvik – Apps can include native code pieces for better performance • Understand your app, & decide based on your app’s needs – If you’re doing lots of drawing, use Dalvik – If you have a web presence already, use (Dalvik-enhanced?) Ajax – If you have large, slow algorithms, use Dalvik + native code – Your skills do mean something: go with what you know! 54
  • 55. And That’s Pretty Much The Long and Short of It Source available at: http://code.google.com/p/hdict 55 Image by Alexander Henning Drachmann; http://www.flickr.com/photos/drachmann/327122302/ Licensed under Creative Commons Attribution-Share Alike