SlideShare a Scribd company logo
1 of 50
Download to read offline
New Android APIs:
Gingerbread and Honeycomb
New Android APIs:
Gingerbread and Honeycomb

              24. März 2011
              Markus Junginger
New Android APIs:
Gingerbread and Honeycomb


              Markus Junginger
              @greenrobot_de
New Android APIs:
Gingerbread and Honeycomb



              @greenrobot_de
New Android APIs:
Gingerbread and Honeycomb
New Android APIs:
Gingerbread and Honeycomb
About me
   Markus Junginger, founder of greenrobot
   2007: First Android app
   2001: First mobile project
   12 years of Java experience
   20 years of development experience
                Android & Mobile Entwicklung
   Android Technology Usergroup München
Outline
 Some history
 Technical look at new APIs (plus code)
 Gingerbread APIs
  – AudioFX, SIP, NFC, strict mode, NDK
 Honeycomb APIs
  – Hardware accelerated UIs, Animations,
    Loaders, Renderscript, …
API Changes History
API Changes History
API Version    API    SDK Released


Releases & Time
                                        Level
                           Previews       -       2007-11
                             since
                              1.0        1        2008-09

                              1.1        2        2009-02
 Release early & often
                              1.5        3        2009-04

 11 official releases        1.6        4        2009-09


 29 months                   2.0        5        2009-10


 Every ~3 months a new
                             2.0.1       6        2009-12

                              2.1        7        2010-01
  release                     2.2        8        2010-05

 Android developers:         2.3        9        2010-12

  constant progress is       2.3.3       10       2011-02

  your chance                3.0        11       2011-02
Android 2.3 Gingerbread
   Performance (Concurrent GC, ext4, …)
   Audio Effects
   SIP
   NFC
   StrictMode
   NDK revamped
Audio Effects
 MediaPlayer & AudioTrack
 Available Effects
  – Equalizer
  – Bass boost
  – Environment reverb
  – Virtualizer
  – Visualizer
 App: Real Time Audio FX
Audio Effects
 MediaPlayer & AudioTrack
 Available Effects
  – Equalizer
  – Bass boost
  – Environment reverb
  – Virtualizer
  – Visualizer
 App: Real Time Audio FX
Audio Effects
   aid = getAudioSessionId() // or 0
   effect = new BassBoost(0, aid)
   effect.setStrength(1000)
   effect.setEnable(true)
   …
   effect.release()
Audio Effects: Equalizer
 android.media.audiofx.Equalizer
 Frequency bands
  – Available number of bands
    getNumberOfBands()
  – Min/Max Level using getBandLevelRange()
  – setBandLevel(band, level)
SIP – Session Initiation Protocol
 Popular for voice and video
  calls over IP
 General purpose
  IM, games, etc.
 REGISTER
 INVITE
 BYE
 Media separate
SIP – Android Classes
   SipManager: central for SIP functionality
   SipProfile: user account data
   SipSession: session
   SipAudioCall: convenience for voice calls
SIP – Basics steps
   Get a SipManager
   Create a “me” and “you” SipProfile
   Use SipManager establish a call
   Once established, start audio
SIP – Code for setup
 manager = SipManager.newInstance(ctx)
 builder = new
    SipProfile.Builder(username, domain)
  me = builder.setPassword(password)
  me = builder.build()
 manager.open(me)
 you = SipProfile.Builder(uri).build()
 // URI Example: “+49891234@sipgate.de”
SIP – Code for making a call
 call = manager.makeAudioCall(me, you,
  listener, timeoutInSeconds)
 SipAudioCall.Listener
  – onCallEstablished(SipAudioCall call)
  – call.startAudio()
    call.setSpeakerMode(true)
    call.toggleMute()
SIP – Availability & permissions
 Check if SIP is available on device
  isApiSupported, isVoipSupported
 Basic permissions
  – INTERNET, USE_SIP
 Audio call permissions
  – RECORD_AUDIO, ACCESS_WIFI_STATE,
    WAKE_LOCK, MODIFY_AUDIO_SETTINGS
Near Field Communication
 NFC: wireless communication within ~4cm
 13 – 106 Kbyte/s
 NFC tags variants (e.g. RFID)
  – Low-end: Read-only and powerless (cheap!)
  –…
  – High-end: full OS, interactive
 Device-to-Device (P2P)
 Major API additions in Android 2.3.3
NFC: Getting notified by Intent
 android.permission.NFC
 <intent-filter><action android:name =
  "android.nfc.action.TAG_DISCOVERED" /
  ></intent-filter
 android.nfc.extra.NDEF_MESSAGES:
  Array of NdefMessage object
 Works with API Level 9
NfcAdapter
 API Level 9
  – static getDefaultAdapter() (deprecated in 10)
  – isEnabled: NFC disabled in system settings?
 API Level 10
  – NfcAdapter.getDefaultAdapter(context)
  – Methods for foreground tag discovery/push
NFC: Foreground actions
 Multiple apps can register for NFC tags
 Foreground NFC: Activity is running
   has priority over other NFC apps
 enableForegroundDispatch: fires Intent
  (PendingIntent) when NFC tag is read
 enableForegroundNdefPush: makes a
  NDEF tag available
NFC: Notes
 API Level 10: more tag technologies
  – Mifare, A, B, F, V, ISO-DEP
  – Filters defined in meta-data XML file
 Filtering by MIME type (e.g. text/plain)
 Working with tags is pretty low level
   bits & bytes
 Nexus S must be really close to tag (<4cm)
Strict mode
 Tool for developers (helper classes)
 Detect performance violations in threads
  – Network operations
  – Disk reads/writes
 Detect leaks (VM wide)
  – Activites
  – Closeable
  – SQLite objects
Strict mode
 Ways to react to violations (penalties)
  – Log, drop box, dialog, or crash
 Strict mode activated & configured in code
 android.os.StrictMode and inner classes
  – Policies
  – Builders
Strict mode – thread policy code
 p= Builder().detectAll().penaltyLog().build()
 StrictMode.setThreadPolicy(p)
 Example log with stack trace
  03-19 20:21:44.292: DEBUG/StrictMode(32242):
  StrictMode policy violation; ~duration=336 ms:
  android.os.StrictMode
  $StrictModeDiskReadViolation: policy=279
  violation=203-19
 Note: MapActivity triggers violations
NDK in Gingerbread
   GCC 4.4.3, ./configure && make
   C++ STL (Standard template library)
   Native Activities
   Less Java wrappers nessesary
    – Input and sensor access
    – Audio (OpenSL)
    – Windows management / pixel buffers
    – Direct access to assets in APK
Android 3.0 Honeycomb
   Fragments (conceptual)
   Hardware accelerated UIs
   Action Bar
   Loaders
   Animations
   Renderscript
   And more…
Hardware accelerated UIs
 Graphics library Skia: CPU based until 2.3
   Software rendering, sometimes slow
 GPU based rendering is faster (mostly)
 Switched off by default
 Manifest entries for application & activity:
  android:hardwareAccelerated=„true“
 Control for windows and views in code:
 view.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
Hardware accelerated UIs, but...
 Hard to test
  – No Android 3.0 device in Germany yet
  – Emulator falls back to software rendering
    (which is really sloooooooooooooooow)
 Not all operations are supported
 Some operations render differently
 Bitmaps must be uploaded as textures
Loader: Asynchronous loading
 Loaders address problems of AsynchTask
  – Don’t restart after configuration changes
  – Ability to monitor data changes
 AsyncTaskLoader     http://code.google.com/p/android/issues/detail?id=14944


 CursorLoader for ContentProviders
 LoaderManager from activity or fragment
Using a CursorLoader
 getLoaderManager().initLoader(0, null, l)
 Implement LoaderCallbacks
  – onCreateLoader: create loader here
  – onLoadFinished: receive the result
  – onLoaderReset: clear the result
 Creating the CursorLoader: like
  ContentResolver.query
  (URI, projection, selection, sort order)
Property Animations
 ValueAnimator: changes value over time
 ObjectAnimator: applies value to an object
 Animation Hello World:
  View text = findViewById(R.id.text);
  ObjectAnimator anim = ObjectAnimator
    .ofFloat(text, "alpha", 0f, 1f);
  anim.setDuration(2000);
  anim.start();
 Much more: sets, listeners, interpolators,...
Renderscript
   Portable high performance (vs. NDK)
   Intermediate LLVM byte code
   Written in C (C99 standard)
   Compiled and cached on the device
   May use CPU or GPU (or even a DSP)
   Native Renderscript APIs
    – Logging, Graphics, Memory
 Doesn’t run on emulator, hard to debug
HC: A lot more to explore…
   New UI widgets, e.g. StackView
   Improved home screen widgets
   System clipboard framework
   Drag & Drop
   Media, e.g. HTTP adaptive streaming
   JSON streaming
   …
So Honeycomb is cool, but…




    (Nevertheless: being among the
      first may be a good strategy)
Android Compatibility package
 Downloadable through SDK Manager
 Some of 3.0 APIs for Android 1.6+
  – Fragments
  – Loader
  – Utils
 Include as jar/source (~100k)
 Package android.support.v4
   won’t use updated APIs on level 11+
Thanks! Q&A

Markus Junginger
markus@greenrobot.de
http://greenrobot.de
Twitter: greenrobot_de

We‘re hiring 
Thanks! Q&A

Markus Junginger
markus@greenrobot.de
http://greenrobot.de
Twitter: greenrobot_de

We‘re hiring 
Fragments




 Modular approach to arrange the UI
 Fragments can be (re)used in activities
 Target multiple device categories
Fragment complexity
 Activities are not trivial
   Lifecycle & process
 Fragments have a
  lifecycle, too
 Interaction with activities
 Fragment transactions
 Android just got more
  complicated powerful
Action Bar



   Part of Honeycomb’s Holographic theme
   Quick access to Options Menu items
   <item android:showAsAction="ifRoom" …
   No room left: overflow menu
Action Bar



   Part of Honeycomb’s Holographic theme
   Quick access to Options Menu items
   <item android:showAsAction="ifRoom" …
   No room left: overflow menu
Action Bar, take me home!




 App icon (by default)
 when onOptionsItemSelected() is called
  – Check for android.R.id.home
  – Go to „home“ activity
    (Intent.FLAG_ACTIVITY_CLEAR_TOP)
Action Bar, take me home!




 App icon (by default)
 when onOptionsItemSelected() is called
  – Check for android.R.id.home
  – Go to „home“ activity
    (Intent.FLAG_ACTIVITY_CLEAR_TOP)
Action Bar: Views and Tabs
 Place custom layouts in the action bar
  <item android:actionLayout="…" … />
 And views (use fully qualified class name)
  <item android:actionViewClass="…" … />
 Tabs use Fragments
 ActionBar: newTab(), addTab()
 TabListener adds/removes Fragements

More Related Content

What's hot

Software update for IoT Embedded World 2017
Software update for IoT Embedded World 2017Software update for IoT Embedded World 2017
Software update for IoT Embedded World 2017Chris Simmonds
 
Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)
Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)
Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)Toshiharu Harada, Ph.D
 
Flash runtime on mobile
Flash runtime on mobileFlash runtime on mobile
Flash runtime on mobilehoward-wu
 
Debugging embedded devices using GDB
Debugging embedded devices using GDBDebugging embedded devices using GDB
Debugging embedded devices using GDBChris Simmonds
 
Quick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOQuick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOChris Simmonds
 
Codestrong 2012 breakout session exploring the new titanium command line in...
Codestrong 2012 breakout session   exploring the new titanium command line in...Codestrong 2012 breakout session   exploring the new titanium command line in...
Codestrong 2012 breakout session exploring the new titanium command line in...Axway Appcelerator
 

What's hot (6)

Software update for IoT Embedded World 2017
Software update for IoT Embedded World 2017Software update for IoT Embedded World 2017
Software update for IoT Embedded World 2017
 
Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)
Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)
Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)
 
Flash runtime on mobile
Flash runtime on mobileFlash runtime on mobile
Flash runtime on mobile
 
Debugging embedded devices using GDB
Debugging embedded devices using GDBDebugging embedded devices using GDB
Debugging embedded devices using GDB
 
Quick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOQuick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIO
 
Codestrong 2012 breakout session exploring the new titanium command line in...
Codestrong 2012 breakout session   exploring the new titanium command line in...Codestrong 2012 breakout session   exploring the new titanium command line in...
Codestrong 2012 breakout session exploring the new titanium command line in...
 

Viewers also liked

Разработка приложений для Android Honeycomb: ActionBar & Fragments
Разработка приложений для Android Honeycomb: ActionBar & FragmentsРазработка приложений для Android Honeycomb: ActionBar & Fragments
Разработка приложений для Android Honeycomb: ActionBar & FragmentsAlexey Ustenko
 
Unit 7-phaserule
Unit 7-phaseruleUnit 7-phaserule
Unit 7-phaseruleanuragmbst
 
Modes of heat transfer
Modes of heat transferModes of heat transfer
Modes of heat transferRIFFAT_ZAHID
 
Transient heat-conduction-Part-I
Transient heat-conduction-Part-ITransient heat-conduction-Part-I
Transient heat-conduction-Part-Itmuliya
 
heat conduction equations
heat conduction equationsheat conduction equations
heat conduction equationsZahir Baloch
 
Radiation heat transfer
Radiation heat transferRadiation heat transfer
Radiation heat transferAravind Sp
 
Lectures on Heat Transfer - Introduction - Applications - Fundamentals - Gove...
Lectures on Heat Transfer - Introduction - Applications - Fundamentals - Gove...Lectures on Heat Transfer - Introduction - Applications - Fundamentals - Gove...
Lectures on Heat Transfer - Introduction - Applications - Fundamentals - Gove...tmuliya
 
02-22-08 - Conduction, Convection & Radiation
02-22-08 - Conduction, Convection & Radiation02-22-08 - Conduction, Convection & Radiation
02-22-08 - Conduction, Convection & Radiationwjerlinger
 
Heat transfer
Heat transferHeat transfer
Heat transferLightkcse
 
Coduction, convection and radiation
Coduction, convection and radiationCoduction, convection and radiation
Coduction, convection and radiationhmsoh
 
Soil mechanics a[1].ppt
Soil mechanics a[1].pptSoil mechanics a[1].ppt
Soil mechanics a[1].pptZakee Kazmee
 
11 Heat Transfer
11 Heat Transfer11 Heat Transfer
11 Heat Transferspsu
 
HVAC Cooling Load Calculation
HVAC Cooling Load CalculationHVAC Cooling Load Calculation
HVAC Cooling Load CalculationOrange Slides
 

Viewers also liked (19)

Perpindahan panas
Perpindahan panasPerpindahan panas
Perpindahan panas
 
Разработка приложений для Android Honeycomb: ActionBar & Fragments
Разработка приложений для Android Honeycomb: ActionBar & FragmentsРазработка приложений для Android Honeycomb: ActionBar & Fragments
Разработка приложений для Android Honeycomb: ActionBar & Fragments
 
Introduction and Basic Modes of Heat Transfer
Introduction and Basic Modes of Heat TransferIntroduction and Basic Modes of Heat Transfer
Introduction and Basic Modes of Heat Transfer
 
Unit 7-phaserule
Unit 7-phaseruleUnit 7-phaserule
Unit 7-phaserule
 
Modes of heat transfer
Modes of heat transferModes of heat transfer
Modes of heat transfer
 
Modes of transfer of heat
Modes of transfer of heatModes of transfer of heat
Modes of transfer of heat
 
Detailed engineering-design-phase
Detailed engineering-design-phaseDetailed engineering-design-phase
Detailed engineering-design-phase
 
Transient heat-conduction-Part-I
Transient heat-conduction-Part-ITransient heat-conduction-Part-I
Transient heat-conduction-Part-I
 
heat conduction equations
heat conduction equationsheat conduction equations
heat conduction equations
 
Radiation heat transfer
Radiation heat transferRadiation heat transfer
Radiation heat transfer
 
Lectures on Heat Transfer - Introduction - Applications - Fundamentals - Gove...
Lectures on Heat Transfer - Introduction - Applications - Fundamentals - Gove...Lectures on Heat Transfer - Introduction - Applications - Fundamentals - Gove...
Lectures on Heat Transfer - Introduction - Applications - Fundamentals - Gove...
 
02-22-08 - Conduction, Convection & Radiation
02-22-08 - Conduction, Convection & Radiation02-22-08 - Conduction, Convection & Radiation
02-22-08 - Conduction, Convection & Radiation
 
Heat transfer
Heat transferHeat transfer
Heat transfer
 
Reactor types.ppt
Reactor types.pptReactor types.ppt
Reactor types.ppt
 
Coduction, convection and radiation
Coduction, convection and radiationCoduction, convection and radiation
Coduction, convection and radiation
 
Heat Transfer
Heat TransferHeat Transfer
Heat Transfer
 
Soil mechanics a[1].ppt
Soil mechanics a[1].pptSoil mechanics a[1].ppt
Soil mechanics a[1].ppt
 
11 Heat Transfer
11 Heat Transfer11 Heat Transfer
11 Heat Transfer
 
HVAC Cooling Load Calculation
HVAC Cooling Load CalculationHVAC Cooling Load Calculation
HVAC Cooling Load Calculation
 

Similar to Droidcon 2011: Gingerbread and honeycomb, Markus Junginger, Greenrobot

Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalNAVER D2
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made EasyAlon Fliess
 
Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Sujee Maniyam
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Lars Vogel
 
Developing FirefoxOS
Developing FirefoxOSDeveloping FirefoxOS
Developing FirefoxOSFred Lin
 
Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Nordic APIs
 
Versioning strategy for a complex internal API
Versioning strategy for a complex internal APIVersioning strategy for a complex internal API
Versioning strategy for a complex internal APIBadoo Development
 
Chicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - MediaflyChicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - MediaflyMediafly
 
Creating Flash Content for Multiple Screens
Creating Flash Content for Multiple ScreensCreating Flash Content for Multiple Screens
Creating Flash Content for Multiple Screenspaultrani
 
Window Shopping Browser - Bug Hunting in 2012
Window Shopping Browser - Bug Hunting in 2012Window Shopping Browser - Bug Hunting in 2012
Window Shopping Browser - Bug Hunting in 2012Roberto Suggi Liverani
 
Android task manager project presentation
Android task manager project presentationAndroid task manager project presentation
Android task manager project presentationAkhilesh Jaiswal
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21dxsaki
 
What's new in android jakarta gdg (2015-08-26)
What's new in android   jakarta gdg (2015-08-26)What's new in android   jakarta gdg (2015-08-26)
What's new in android jakarta gdg (2015-08-26)Google
 
MongoDB World 2019: In-App Bug Reporting
MongoDB World 2019: In-App Bug ReportingMongoDB World 2019: In-App Bug Reporting
MongoDB World 2019: In-App Bug ReportingMongoDB
 

Similar to Droidcon 2011: Gingerbread and honeycomb, Markus Junginger, Greenrobot (20)

Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)
 
Yatoto-technical
Yatoto-technicalYatoto-technical
Yatoto-technical
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11
 
Android session-1-sajib
Android session-1-sajibAndroid session-1-sajib
Android session-1-sajib
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Developing FirefoxOS
Developing FirefoxOSDeveloping FirefoxOS
Developing FirefoxOS
 
Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)
 
Versioning strategy for a complex internal API
Versioning strategy for a complex internal APIVersioning strategy for a complex internal API
Versioning strategy for a complex internal API
 
Android tutorial1
Android tutorial1Android tutorial1
Android tutorial1
 
Chicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - MediaflyChicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - Mediafly
 
Creating Flash Content for Multiple Screens
Creating Flash Content for Multiple ScreensCreating Flash Content for Multiple Screens
Creating Flash Content for Multiple Screens
 
Window Shopping Browser - Bug Hunting in 2012
Window Shopping Browser - Bug Hunting in 2012Window Shopping Browser - Bug Hunting in 2012
Window Shopping Browser - Bug Hunting in 2012
 
Android task manager project presentation
Android task manager project presentationAndroid task manager project presentation
Android task manager project presentation
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21
 
What's new in android jakarta gdg (2015-08-26)
What's new in android   jakarta gdg (2015-08-26)What's new in android   jakarta gdg (2015-08-26)
What's new in android jakarta gdg (2015-08-26)
 
Android platform
Android platform Android platform
Android platform
 
MongoDB World 2019: In-App Bug Reporting
MongoDB World 2019: In-App Bug ReportingMongoDB World 2019: In-App Bug Reporting
MongoDB World 2019: In-App Bug Reporting
 

More from Droidcon Berlin

Droidcon de 2014 google cast
Droidcon de 2014   google castDroidcon de 2014   google cast
Droidcon de 2014 google castDroidcon Berlin
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limitsDroidcon Berlin
 
Android industrial mobility
Android industrial mobility Android industrial mobility
Android industrial mobility Droidcon Berlin
 
From sensor data_to_android_and_back
From sensor data_to_android_and_backFrom sensor data_to_android_and_back
From sensor data_to_android_and_backDroidcon Berlin
 
new_age_graphics_android_x86
new_age_graphics_android_x86new_age_graphics_android_x86
new_age_graphics_android_x86Droidcon Berlin
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building AndroidDroidcon Berlin
 
Matchinguu droidcon presentation
Matchinguu droidcon presentationMatchinguu droidcon presentation
Matchinguu droidcon presentationDroidcon Berlin
 
Cgm life sdk_droidcon_2014_v3
Cgm life sdk_droidcon_2014_v3Cgm life sdk_droidcon_2014_v3
Cgm life sdk_droidcon_2014_v3Droidcon Berlin
 
The artofcalabash peterkrauss
The artofcalabash peterkraussThe artofcalabash peterkrauss
The artofcalabash peterkraussDroidcon Berlin
 
Raesch, gries droidcon 2014
Raesch, gries   droidcon 2014Raesch, gries   droidcon 2014
Raesch, gries droidcon 2014Droidcon Berlin
 
Android open gl2_droidcon_2014
Android open gl2_droidcon_2014Android open gl2_droidcon_2014
Android open gl2_droidcon_2014Droidcon Berlin
 
20140508 quantified self droidcon
20140508 quantified self droidcon20140508 quantified self droidcon
20140508 quantified self droidconDroidcon Berlin
 
Tuning android for low ram devices
Tuning android for low ram devicesTuning android for low ram devices
Tuning android for low ram devicesDroidcon Berlin
 
Froyo to kit kat two years developing & maintaining deliradio
Froyo to kit kat   two years developing & maintaining deliradioFroyo to kit kat   two years developing & maintaining deliradio
Froyo to kit kat two years developing & maintaining deliradioDroidcon Berlin
 
Droidcon2013 security genes_trendmicro
Droidcon2013 security genes_trendmicroDroidcon2013 security genes_trendmicro
Droidcon2013 security genes_trendmicroDroidcon Berlin
 

More from Droidcon Berlin (20)

Droidcon de 2014 google cast
Droidcon de 2014   google castDroidcon de 2014   google cast
Droidcon de 2014 google cast
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limits
 
crashing in style
crashing in stylecrashing in style
crashing in style
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 
Android industrial mobility
Android industrial mobility Android industrial mobility
Android industrial mobility
 
Details matter in ux
Details matter in uxDetails matter in ux
Details matter in ux
 
From sensor data_to_android_and_back
From sensor data_to_android_and_backFrom sensor data_to_android_and_back
From sensor data_to_android_and_back
 
droidparts
droidpartsdroidparts
droidparts
 
new_age_graphics_android_x86
new_age_graphics_android_x86new_age_graphics_android_x86
new_age_graphics_android_x86
 
5 tips of monetization
5 tips of monetization5 tips of monetization
5 tips of monetization
 
Testing and Building Android
Testing and Building AndroidTesting and Building Android
Testing and Building Android
 
Matchinguu droidcon presentation
Matchinguu droidcon presentationMatchinguu droidcon presentation
Matchinguu droidcon presentation
 
Cgm life sdk_droidcon_2014_v3
Cgm life sdk_droidcon_2014_v3Cgm life sdk_droidcon_2014_v3
Cgm life sdk_droidcon_2014_v3
 
The artofcalabash peterkrauss
The artofcalabash peterkraussThe artofcalabash peterkrauss
The artofcalabash peterkrauss
 
Raesch, gries droidcon 2014
Raesch, gries   droidcon 2014Raesch, gries   droidcon 2014
Raesch, gries droidcon 2014
 
Android open gl2_droidcon_2014
Android open gl2_droidcon_2014Android open gl2_droidcon_2014
Android open gl2_droidcon_2014
 
20140508 quantified self droidcon
20140508 quantified self droidcon20140508 quantified self droidcon
20140508 quantified self droidcon
 
Tuning android for low ram devices
Tuning android for low ram devicesTuning android for low ram devices
Tuning android for low ram devices
 
Froyo to kit kat two years developing & maintaining deliradio
Froyo to kit kat   two years developing & maintaining deliradioFroyo to kit kat   two years developing & maintaining deliradio
Froyo to kit kat two years developing & maintaining deliradio
 
Droidcon2013 security genes_trendmicro
Droidcon2013 security genes_trendmicroDroidcon2013 security genes_trendmicro
Droidcon2013 security genes_trendmicro
 

Recently uploaded

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
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
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
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Recently uploaded (20)

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
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Droidcon 2011: Gingerbread and honeycomb, Markus Junginger, Greenrobot

  • 2. New Android APIs: Gingerbread and Honeycomb 24. März 2011 Markus Junginger
  • 3. New Android APIs: Gingerbread and Honeycomb Markus Junginger @greenrobot_de
  • 4. New Android APIs: Gingerbread and Honeycomb @greenrobot_de
  • 7. About me  Markus Junginger, founder of greenrobot  2007: First Android app  2001: First mobile project  12 years of Java experience  20 years of development experience  Android & Mobile Entwicklung  Android Technology Usergroup München
  • 8. Outline  Some history  Technical look at new APIs (plus code)  Gingerbread APIs – AudioFX, SIP, NFC, strict mode, NDK  Honeycomb APIs – Hardware accelerated UIs, Animations, Loaders, Renderscript, …
  • 11. API Version API SDK Released Releases & Time Level Previews - 2007-11 since 1.0 1 2008-09 1.1 2 2009-02  Release early & often 1.5 3 2009-04  11 official releases 1.6 4 2009-09  29 months 2.0 5 2009-10  Every ~3 months a new 2.0.1 6 2009-12 2.1 7 2010-01 release 2.2 8 2010-05  Android developers: 2.3 9 2010-12 constant progress is 2.3.3 10 2011-02 your chance  3.0 11 2011-02
  • 12. Android 2.3 Gingerbread  Performance (Concurrent GC, ext4, …)  Audio Effects  SIP  NFC  StrictMode  NDK revamped
  • 13. Audio Effects  MediaPlayer & AudioTrack  Available Effects – Equalizer – Bass boost – Environment reverb – Virtualizer – Visualizer  App: Real Time Audio FX
  • 14. Audio Effects  MediaPlayer & AudioTrack  Available Effects – Equalizer – Bass boost – Environment reverb – Virtualizer – Visualizer  App: Real Time Audio FX
  • 15. Audio Effects  aid = getAudioSessionId() // or 0  effect = new BassBoost(0, aid)  effect.setStrength(1000)  effect.setEnable(true)  …  effect.release()
  • 16. Audio Effects: Equalizer  android.media.audiofx.Equalizer  Frequency bands – Available number of bands getNumberOfBands() – Min/Max Level using getBandLevelRange() – setBandLevel(band, level)
  • 17. SIP – Session Initiation Protocol  Popular for voice and video calls over IP  General purpose IM, games, etc.  REGISTER  INVITE  BYE  Media separate
  • 18. SIP – Android Classes  SipManager: central for SIP functionality  SipProfile: user account data  SipSession: session  SipAudioCall: convenience for voice calls
  • 19. SIP – Basics steps  Get a SipManager  Create a “me” and “you” SipProfile  Use SipManager establish a call  Once established, start audio
  • 20. SIP – Code for setup  manager = SipManager.newInstance(ctx)  builder = new SipProfile.Builder(username, domain) me = builder.setPassword(password) me = builder.build()  manager.open(me)  you = SipProfile.Builder(uri).build()  // URI Example: “+49891234@sipgate.de”
  • 21. SIP – Code for making a call  call = manager.makeAudioCall(me, you, listener, timeoutInSeconds)  SipAudioCall.Listener – onCallEstablished(SipAudioCall call) – call.startAudio() call.setSpeakerMode(true) call.toggleMute()
  • 22. SIP – Availability & permissions  Check if SIP is available on device isApiSupported, isVoipSupported  Basic permissions – INTERNET, USE_SIP  Audio call permissions – RECORD_AUDIO, ACCESS_WIFI_STATE, WAKE_LOCK, MODIFY_AUDIO_SETTINGS
  • 23. Near Field Communication  NFC: wireless communication within ~4cm  13 – 106 Kbyte/s  NFC tags variants (e.g. RFID) – Low-end: Read-only and powerless (cheap!) –… – High-end: full OS, interactive  Device-to-Device (P2P)  Major API additions in Android 2.3.3
  • 24. NFC: Getting notified by Intent  android.permission.NFC  <intent-filter><action android:name = "android.nfc.action.TAG_DISCOVERED" / ></intent-filter  android.nfc.extra.NDEF_MESSAGES: Array of NdefMessage object  Works with API Level 9
  • 25. NfcAdapter  API Level 9 – static getDefaultAdapter() (deprecated in 10) – isEnabled: NFC disabled in system settings?  API Level 10 – NfcAdapter.getDefaultAdapter(context) – Methods for foreground tag discovery/push
  • 26. NFC: Foreground actions  Multiple apps can register for NFC tags  Foreground NFC: Activity is running  has priority over other NFC apps  enableForegroundDispatch: fires Intent (PendingIntent) when NFC tag is read  enableForegroundNdefPush: makes a NDEF tag available
  • 27. NFC: Notes  API Level 10: more tag technologies – Mifare, A, B, F, V, ISO-DEP – Filters defined in meta-data XML file  Filtering by MIME type (e.g. text/plain)  Working with tags is pretty low level  bits & bytes  Nexus S must be really close to tag (<4cm)
  • 28. Strict mode  Tool for developers (helper classes)  Detect performance violations in threads – Network operations – Disk reads/writes  Detect leaks (VM wide) – Activites – Closeable – SQLite objects
  • 29. Strict mode  Ways to react to violations (penalties) – Log, drop box, dialog, or crash  Strict mode activated & configured in code  android.os.StrictMode and inner classes – Policies – Builders
  • 30. Strict mode – thread policy code  p= Builder().detectAll().penaltyLog().build()  StrictMode.setThreadPolicy(p)  Example log with stack trace 03-19 20:21:44.292: DEBUG/StrictMode(32242): StrictMode policy violation; ~duration=336 ms: android.os.StrictMode $StrictModeDiskReadViolation: policy=279 violation=203-19  Note: MapActivity triggers violations
  • 31. NDK in Gingerbread  GCC 4.4.3, ./configure && make  C++ STL (Standard template library)  Native Activities  Less Java wrappers nessesary – Input and sensor access – Audio (OpenSL) – Windows management / pixel buffers – Direct access to assets in APK
  • 32. Android 3.0 Honeycomb  Fragments (conceptual)  Hardware accelerated UIs  Action Bar  Loaders  Animations  Renderscript  And more…
  • 33. Hardware accelerated UIs  Graphics library Skia: CPU based until 2.3  Software rendering, sometimes slow  GPU based rendering is faster (mostly)  Switched off by default  Manifest entries for application & activity: android:hardwareAccelerated=„true“  Control for windows and views in code: view.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
  • 34. Hardware accelerated UIs, but...  Hard to test – No Android 3.0 device in Germany yet – Emulator falls back to software rendering (which is really sloooooooooooooooow)  Not all operations are supported  Some operations render differently  Bitmaps must be uploaded as textures
  • 35. Loader: Asynchronous loading  Loaders address problems of AsynchTask – Don’t restart after configuration changes – Ability to monitor data changes  AsyncTaskLoader http://code.google.com/p/android/issues/detail?id=14944  CursorLoader for ContentProviders  LoaderManager from activity or fragment
  • 36. Using a CursorLoader  getLoaderManager().initLoader(0, null, l)  Implement LoaderCallbacks – onCreateLoader: create loader here – onLoadFinished: receive the result – onLoaderReset: clear the result  Creating the CursorLoader: like ContentResolver.query (URI, projection, selection, sort order)
  • 37. Property Animations  ValueAnimator: changes value over time  ObjectAnimator: applies value to an object  Animation Hello World: View text = findViewById(R.id.text); ObjectAnimator anim = ObjectAnimator .ofFloat(text, "alpha", 0f, 1f); anim.setDuration(2000); anim.start();  Much more: sets, listeners, interpolators,...
  • 38. Renderscript  Portable high performance (vs. NDK)  Intermediate LLVM byte code  Written in C (C99 standard)  Compiled and cached on the device  May use CPU or GPU (or even a DSP)  Native Renderscript APIs – Logging, Graphics, Memory  Doesn’t run on emulator, hard to debug
  • 39. HC: A lot more to explore…  New UI widgets, e.g. StackView  Improved home screen widgets  System clipboard framework  Drag & Drop  Media, e.g. HTTP adaptive streaming  JSON streaming  …
  • 40. So Honeycomb is cool, but… (Nevertheless: being among the first may be a good strategy)
  • 41. Android Compatibility package  Downloadable through SDK Manager  Some of 3.0 APIs for Android 1.6+ – Fragments – Loader – Utils  Include as jar/source (~100k)  Package android.support.v4  won’t use updated APIs on level 11+
  • 44. Fragments  Modular approach to arrange the UI  Fragments can be (re)used in activities  Target multiple device categories
  • 45. Fragment complexity  Activities are not trivial  Lifecycle & process  Fragments have a lifecycle, too  Interaction with activities  Fragment transactions  Android just got more complicated powerful
  • 46. Action Bar  Part of Honeycomb’s Holographic theme  Quick access to Options Menu items  <item android:showAsAction="ifRoom" …  No room left: overflow menu
  • 47. Action Bar  Part of Honeycomb’s Holographic theme  Quick access to Options Menu items  <item android:showAsAction="ifRoom" …  No room left: overflow menu
  • 48. Action Bar, take me home!  App icon (by default)  when onOptionsItemSelected() is called – Check for android.R.id.home – Go to „home“ activity (Intent.FLAG_ACTIVITY_CLEAR_TOP)
  • 49. Action Bar, take me home!  App icon (by default)  when onOptionsItemSelected() is called – Check for android.R.id.home – Go to „home“ activity (Intent.FLAG_ACTIVITY_CLEAR_TOP)
  • 50. Action Bar: Views and Tabs  Place custom layouts in the action bar <item android:actionLayout="…" … />  And views (use fully qualified class name) <item android:actionViewClass="…" … />  Tabs use Fragments  ActionBar: newTab(), addTab()  TabListener adds/removes Fragements