SlideShare a Scribd company logo
1 of 24
The Motorola Developer Network
Optimizing Your Android AppOptimizing Your Android App
For Mass Market DevicesFor Mass Market Devices
Lori Fraleigh
Director, Developer Platforms,
Tools & Technical Services
Motorola Mobility
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Sample Device Differences
DROID XTM
Platform: Android 2.1
Input: Touch, h/w buttons
Display: 4.3” 480 X 854
(FWVGA)
Orientation: Portrait
Navigation: touch display
Notifications: Tri-color
LED, vibration,
status bar, sound
FLIPOUTTM
Platform: Android 2.1
Input: Qwerty keyboard,
touch, h/w buttons
Display: 2.8” 320X240
(QVGA)
Orientation: Landscape
Navigation: touch display,
5-way rocker
Notifications: Flashing
buttons, vibration,
status bar, sound
CHARMTM
Platform: Android 2.1
Input: Qwerty keyboard,
touch, h/w buttons
Display: 2.8” 320X240
(QVGA)
Orientation: Landscape
Navigation: touch display,
5-way rocker, rear
touchpad
Notifications: White LED,
vibration, status bar,
sound
DROID 2/Milestone 2TM
Platform: Android 2.2
Input: Qwerty keyboard, touch,
h/w buttons
Display: 3.7” 480 X 854
(FWVGA)
Orientation: Portrait
Navigation: touch display, 5-
way rocker
Notifications: Tri-color LED,
vibration, status bar,
sound
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Differentiating Areas
• Platform Version
– SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2
• Display
– QVGA vs HVGA vs WVGA
• Orientation
– Landscape or Portrait
• Camera
– Flash and Focus
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Device Dashboard
This data is based on the number of
Android devices that have accessed
Android Market within a 14 day period
ending on 9/1/2010.
Android
Platform
Percent
of Devices
Android 1.5 (3) 12.0%
Android 1.6 (4) 17.5%
Android 2.1 (5,6,7) 41.7%
Android 2.2 (8) 28.7%
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
API Level
<uses-sdk android:minSdkVersion=“<API Level>”
android:targetSdkVersion=“<API Level>”/>
minSdkVersion
• Required; defaults to 1 indicating your app is compatible
with all versions of Android. Use caution!
• Set to the lowest possible number of the platform you want
to deploy your application on
• Used by adb when app is installed to verify device is
running at same API level or higher (for example sideways
install)
• Also used by Android Market to filter what applications are
available on devices
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
API Level (con’t)
<uses-sdk android:minSdkVersion=“<API Level>”
android:targetSdkVersion=“<API Level>”/>
targetSdkVersion
• Optional; set to API level that application has been
tested against
• Enables or disables compatibility mode
– targetSdkVersion = 3
• Want app to look the same on all devices and display at 160
• However, defaults for other manifest values will preclude app
from QVGA devices
– targetSdkVersion > 3
• Want app to run at resolution of device; avail on all screens
sizes
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Differentiating Areas
• Platform Version
– SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2
• Display
– QVGA vs HVGA vs WVGA
• Orientation
– Landscape or Portrait
• Camera
– Flash and Focus
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Display
• QVGA vs HVGA vs WVGA/FWVGA?
• Size doesn’t matter (well sort of doesn’t matter)
• Density does matter
– Device Independent Pixels (dip or dp /density independent)
– Physical pixels
– Logical Density : Scale factor between DIP and PIX
• Density determines what the application looks like
across devices
• You can determine what density your app runs at
through a few mechanisms
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Range of Densities
Logical
Density
Dpi (Resolution) Screen Size Android Devices
0.75 120 Small (QVGA)
Motorola:
-- FLIPOUT
-- CHARM
1.0 160
Normal
(HVGA)
Motorola:
-- CLIQ/DEXT
-- Motorola i1
-- BACKFLIP
1.5 240
Large
(WVGA)
Motorola:
-- DROID/Milestone
-- DROID X
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Coding for Different Displays
• Enabling or disabling compatibility mode through your
AndroidManifest file
• Using density-independent pixel values in your
application and pre-scaling your background
• Including XML resources!
• Creating multiple resource files at different densities
and screen sizes
• drawable-ldpi, drawable-mdpi, drawable-hdpi
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Filtering on Display Sizes
• Can limit the application from installing on devices with
different screen sizes
<supports_screens
android:smallScreens=“true|false“ // qvga
android:normalScreens=“true|false“ // hvga
android:largeScreens=“true|false“ // wvga
android:anyDensity=“true|false" /> // dpi
• Market will block application from displaying on device
where screensize = false
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Differentiating Areas
• Platform Version
– SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2
• Display
– QVGA vs HVGA vs WVGA
• Orientation
– Landscape or Portrait
• Camera
– Flash and Focus
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Orientation
• Two devices in our portfolio, CHARM and FLIPOUT,
have a default orientation of landscape
• Most keyboard enabled devices rotate to landscape
when keyboard is opened
• To account for different configurations, every application
should:
− Create layouts that handle rotation
− Set the rotation behavior in your AndroidManifest file
− Handle rotation in your application code by saving state or
caching data
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Orientation (con’t)
• Create layouts that handle rotation ….
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Orientation (con’t)
• Let your activity auto-rotate
<activity android:name=".MainActivity”
android:label="@string/app_name”
android:screenOrientation="unspecified" >
• When an activity display rotates, the activity is destroyed
and re-created. To avoid delay’s in reloading data…..
− cache data before the screen rotates using
onRetainNonConfigurationInstance()
− restore it from onCreate() after rotation using
getLastNonConfigurationInstance()
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Sensor-Based Orientation
• Additional tips for games that use the accelerometer or
other motion-based sensors
• Android Developer Blog
• One Screen Turn Deserves Another http://android-
developers.blogspot.com/2010/09/one-screen-turn-deserves-
another.html
• MOTODEV Technical Library
• Handle Sensor-Based Screen Orientation
http://developer.motorola.com/docstools/library/FLIPOUT_Pr
ogramming_Tips/
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Differentiating Areas
• Platform Version
– SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2
• Display
– QVGA vs HVGA vs WVGA
• Orientation
• Landscape or Portrait
• Camera
– Flash or Focus
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Camera
• Many mass market devices will not have the same type
of camera as a high-end smartphone
• If your app manifest declares the CAMERA permission
<uses-permission android:name=“CAMERA” />
• You should also specify
<uses-feature
android:name=“android.hardware.camera” />
• If you do not specify any uses-feature elements for
camera, your app is assumed to use both autofocus and
flash
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Camera (con’t)
• If your app does require either flash and/or autofocus
capabilities, make sure you declare them
<uses-feature
android:name=“android.hardware.camera.autofocus
” />
<uses-feature
android:name=“android.hardware.camera.flash” />
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Differentiating Areas
• Platform Version
– SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2
• Display
– QVGA vs HVGA vs WVGA
• Orientation
– Landscape or Portrait
• Camera
– Flash and Focus
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
Device Configuration: How to tell?
• Programmatically getting device configurations
− android.content.res.Configuration
− android.util.DisplayMetrics
− android.os.Build etc…….
• Technical Specifications page for every Motorola device
− developer.motorola.com/products
− As of today there are specs on 26 Android devices
− Tracks between 50 – 60 configuration options that developers
would be interested in
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.DEVELOPDESIGN DISCOVER DISTRIBUTE
For More Information
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
THANK YOU
Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.
License
• Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.
• Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
• Portions of this presentation are modifications based on work created and shared by
Google and used according to terms described in the Creative Commons 3.0 Attribution
License.

More Related Content

Similar to Optimizing your Android App for Mass Market Devices

HTML5 vs Native Android: Smart Enterprises for the Future
HTML5 vs Native Android: Smart Enterprises for the FutureHTML5 vs Native Android: Smart Enterprises for the Future
HTML5 vs Native Android: Smart Enterprises for the FutureMotorola Mobility - MOTODEV
 
Crossware-Introduction_AmitDhagat-reduced.pdf
Crossware-Introduction_AmitDhagat-reduced.pdfCrossware-Introduction_AmitDhagat-reduced.pdf
Crossware-Introduction_AmitDhagat-reduced.pdfv89wytwpyn
 
Android Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинAndroid Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинGDG Saint Petersburg
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011sullis
 
Getting started with android programming
Getting started with android programmingGetting started with android programming
Getting started with android programmingPERKYTORIALS
 
Android Mobile Application Testing: Human Interface Guideline, Tools
Android Mobile Application Testing: Human Interface Guideline, ToolsAndroid Mobile Application Testing: Human Interface Guideline, Tools
Android Mobile Application Testing: Human Interface Guideline, ToolsSoftServe
 
Mobile Saturday. Тема 3. Особенности тестирования приложения на Android: Huma...
Mobile Saturday. Тема 3. Особенности тестирования приложения на Android: Huma...Mobile Saturday. Тема 3. Особенности тестирования приложения на Android: Huma...
Mobile Saturday. Тема 3. Особенности тестирования приложения на Android: Huma...GoIT
 
Android App Development 01 : Getting Start
Android App Development 01 : Getting StartAndroid App Development 01 : Getting Start
Android App Development 01 : Getting StartAnuchit Chalothorn
 
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assARVIND SARDAR
 
App forum2015 London - RhoMobile Update
App forum2015 London - RhoMobile UpdateApp forum2015 London - RhoMobile Update
App forum2015 London - RhoMobile Updaterobgalvinjr
 
ANDROID- AN OPEN MOBILE SOFTWARE PLATFORM
ANDROID- AN OPEN MOBILE SOFTWARE PLATFORMANDROID- AN OPEN MOBILE SOFTWARE PLATFORM
ANDROID- AN OPEN MOBILE SOFTWARE PLATFORMSHASHI JAISWAL
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsPositive Hack Days
 
Google IO 2014 overview
Google IO 2014 overviewGoogle IO 2014 overview
Google IO 2014 overviewBin Yang
 
Microsoft Automotive Business Unit - J Za
Microsoft Automotive Business Unit - J ZaMicrosoft Automotive Business Unit - J Za
Microsoft Automotive Business Unit - J Zamfrancis
 

Similar to Optimizing your Android App for Mass Market Devices (20)

HTML5 vs Native Android: Smart Enterprises for the Future
HTML5 vs Native Android: Smart Enterprises for the FutureHTML5 vs Native Android: Smart Enterprises for the Future
HTML5 vs Native Android: Smart Enterprises for the Future
 
Introduction to Android
Introduction to AndroidIntroduction to Android
Introduction to Android
 
Partner_Summit.pdf
Partner_Summit.pdfPartner_Summit.pdf
Partner_Summit.pdf
 
Crossware-Introduction_AmitDhagat-reduced.pdf
Crossware-Introduction_AmitDhagat-reduced.pdfCrossware-Introduction_AmitDhagat-reduced.pdf
Crossware-Introduction_AmitDhagat-reduced.pdf
 
Android Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинAndroid Meetup, Илья Лёвин
Android Meetup, Илья Лёвин
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
 
Getting started with android programming
Getting started with android programmingGetting started with android programming
Getting started with android programming
 
Android
AndroidAndroid
Android
 
Android based os
Android based osAndroid based os
Android based os
 
Android Mobile Application Testing: Human Interface Guideline, Tools
Android Mobile Application Testing: Human Interface Guideline, ToolsAndroid Mobile Application Testing: Human Interface Guideline, Tools
Android Mobile Application Testing: Human Interface Guideline, Tools
 
Mobile Saturday. Тема 3. Особенности тестирования приложения на Android: Huma...
Mobile Saturday. Тема 3. Особенности тестирования приложения на Android: Huma...Mobile Saturday. Тема 3. Особенности тестирования приложения на Android: Huma...
Mobile Saturday. Тема 3. Особенности тестирования приложения на Android: Huma...
 
Boodskap overview
Boodskap overview Boodskap overview
Boodskap overview
 
Android App Development 01 : Getting Start
Android App Development 01 : Getting StartAndroid App Development 01 : Getting Start
Android App Development 01 : Getting Start
 
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-ass
 
App forum2015 London - RhoMobile Update
App forum2015 London - RhoMobile UpdateApp forum2015 London - RhoMobile Update
App forum2015 London - RhoMobile Update
 
ANDROID- AN OPEN MOBILE SOFTWARE PLATFORM
ANDROID- AN OPEN MOBILE SOFTWARE PLATFORMANDROID- AN OPEN MOBILE SOFTWARE PLATFORM
ANDROID- AN OPEN MOBILE SOFTWARE PLATFORM
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
 
Google IO 2014 overview
Google IO 2014 overviewGoogle IO 2014 overview
Google IO 2014 overview
 
Microsoft Automotive Business Unit - J Za
Microsoft Automotive Business Unit - J ZaMicrosoft Automotive Business Unit - J Za
Microsoft Automotive Business Unit - J Za
 
Getting started with PhoneGap
Getting started with PhoneGapGetting started with PhoneGap
Getting started with PhoneGap
 

More from Motorola Mobility - MOTODEV

Getting Your App Discovered: Android Market & Beyond
Getting Your App Discovered: Android Market & BeyondGetting Your App Discovered: Android Market & Beyond
Getting Your App Discovered: Android Market & BeyondMotorola Mobility - MOTODEV
 
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript Motorola Mobility - MOTODEV
 
Consejos principales para Android UI Cómo alcanzar la magia en los tablets
Consejos principales para Android UI Cómo alcanzar la magia en los tabletsConsejos principales para Android UI Cómo alcanzar la magia en los tablets
Consejos principales para Android UI Cómo alcanzar la magia en los tabletsMotorola Mobility - MOTODEV
 
Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo agregar calidad a sus aplicaciones mediante pruebas Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo agregar calidad a sus aplicaciones mediante pruebas Motorola Mobility - MOTODEV
 
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuarioCómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuarioMotorola Mobility - MOTODEV
 
Gráficos cada vez mais rápidos utilização de NDK e Renderscript
Gráficos cada vez mais rápidos utilização de NDK e RenderscriptGráficos cada vez mais rápidos utilização de NDK e Renderscript
Gráficos cada vez mais rápidos utilização de NDK e RenderscriptMotorola Mobility - MOTODEV
 
Como integrar qualidade aos seus aplicativos através de testes
Como integrar qualidade aos seus aplicativos através de testesComo integrar qualidade aos seus aplicativos através de testes
Como integrar qualidade aos seus aplicativos através de testesMotorola Mobility - MOTODEV
 

More from Motorola Mobility - MOTODEV (20)

The Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. WebThe Enterprise Dilemma: Native vs. Web
The Enterprise Dilemma: Native vs. Web
 
Kill the Laptop!
Kill the Laptop!Kill the Laptop!
Kill the Laptop!
 
MOTODEV App Validator
MOTODEV App ValidatorMOTODEV App Validator
MOTODEV App Validator
 
Beautifully Usable, Multiple Screens Too
Beautifully Usable, Multiple Screens TooBeautifully Usable, Multiple Screens Too
Beautifully Usable, Multiple Screens Too
 
Getting the Magic on Android Tablets
Getting the Magic on Android TabletsGetting the Magic on Android Tablets
Getting the Magic on Android Tablets
 
Getting Your App Discovered: Android Market & Beyond
Getting Your App Discovered: Android Market & BeyondGetting Your App Discovered: Android Market & Beyond
Getting Your App Discovered: Android Market & Beyond
 
Introducing Fragments
Introducing FragmentsIntroducing Fragments
Introducing Fragments
 
Taking Advantage of Webtop
Taking Advantage of WebtopTaking Advantage of Webtop
Taking Advantage of Webtop
 
Building Quality Into Your Apps Through Testing
Building Quality Into Your Apps Through TestingBuilding Quality Into Your Apps Through Testing
Building Quality Into Your Apps Through Testing
 
Top Tips for Android UIs
Top Tips for Android UIsTop Tips for Android UIs
Top Tips for Android UIs
 
Designing Apps for Motorla Xoom Tablet
Designing Apps for Motorla Xoom TabletDesigning Apps for Motorla Xoom Tablet
Designing Apps for Motorla Xoom Tablet
 
Diseñando aplicaciones para el Motorola XOOM
Diseñando aplicaciones para el Motorola XOOM Diseñando aplicaciones para el Motorola XOOM
Diseñando aplicaciones para el Motorola XOOM
 
Presentación de los fragmentos
Presentación de los fragmentos Presentación de los fragmentos
Presentación de los fragmentos
 
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
Gráficos cada vez más rápidos. Cómo usar NDK y RenderScript
 
Consejos principales para Android UI Cómo alcanzar la magia en los tablets
Consejos principales para Android UI Cómo alcanzar la magia en los tabletsConsejos principales para Android UI Cómo alcanzar la magia en los tablets
Consejos principales para Android UI Cómo alcanzar la magia en los tablets
 
Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo agregar calidad a sus aplicaciones mediante pruebas Cómo agregar calidad a sus aplicaciones mediante pruebas
Cómo agregar calidad a sus aplicaciones mediante pruebas
 
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuarioCómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
Cómo aprovechar Webtop Cómo HTML5 mejora la experiencia del usuario
 
Principais dicas para UIs do Android
Principais dicas para UIs do AndroidPrincipais dicas para UIs do Android
Principais dicas para UIs do Android
 
Gráficos cada vez mais rápidos utilização de NDK e Renderscript
Gráficos cada vez mais rápidos utilização de NDK e RenderscriptGráficos cada vez mais rápidos utilização de NDK e Renderscript
Gráficos cada vez mais rápidos utilização de NDK e Renderscript
 
Como integrar qualidade aos seus aplicativos através de testes
Como integrar qualidade aos seus aplicativos através de testesComo integrar qualidade aos seus aplicativos através de testes
Como integrar qualidade aos seus aplicativos através de testes
 

Recently uploaded

EMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarEMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarThousandEyes
 
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveKeep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveIES VE
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIVijayananda Mohire
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024Brian Pichman
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3DianaGray10
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4DianaGray10
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingFrancesco Corti
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdfThe Good Food Institute
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch TuesdayIvanti
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosErol GIRAUDY
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...DianaGray10
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNeo4j
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
From the origin to the future of Open Source model and business
From the origin to the future of  Open Source model and businessFrom the origin to the future of  Open Source model and business
From the origin to the future of Open Source model and businessFrancesco Corti
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updateadam112203
 

Recently uploaded (20)

EMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarEMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? Webinar
 
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveKeep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAI
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is going
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch Tuesday
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenarios
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...
 
Novo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4jNovo Nordisk's journey in developing an open-source application on Neo4j
Novo Nordisk's journey in developing an open-source application on Neo4j
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
From the origin to the future of Open Source model and business
From the origin to the future of  Open Source model and businessFrom the origin to the future of  Open Source model and business
From the origin to the future of Open Source model and business
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 update
 

Optimizing your Android App for Mass Market Devices

  • 1. The Motorola Developer Network Optimizing Your Android AppOptimizing Your Android App For Mass Market DevicesFor Mass Market Devices Lori Fraleigh Director, Developer Platforms, Tools & Technical Services Motorola Mobility
  • 2. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Sample Device Differences DROID XTM Platform: Android 2.1 Input: Touch, h/w buttons Display: 4.3” 480 X 854 (FWVGA) Orientation: Portrait Navigation: touch display Notifications: Tri-color LED, vibration, status bar, sound FLIPOUTTM Platform: Android 2.1 Input: Qwerty keyboard, touch, h/w buttons Display: 2.8” 320X240 (QVGA) Orientation: Landscape Navigation: touch display, 5-way rocker Notifications: Flashing buttons, vibration, status bar, sound CHARMTM Platform: Android 2.1 Input: Qwerty keyboard, touch, h/w buttons Display: 2.8” 320X240 (QVGA) Orientation: Landscape Navigation: touch display, 5-way rocker, rear touchpad Notifications: White LED, vibration, status bar, sound DROID 2/Milestone 2TM Platform: Android 2.2 Input: Qwerty keyboard, touch, h/w buttons Display: 3.7” 480 X 854 (FWVGA) Orientation: Portrait Navigation: touch display, 5- way rocker Notifications: Tri-color LED, vibration, status bar, sound
  • 3. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Differentiating Areas • Platform Version – SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2 • Display – QVGA vs HVGA vs WVGA • Orientation – Landscape or Portrait • Camera – Flash and Focus
  • 4. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Device Dashboard This data is based on the number of Android devices that have accessed Android Market within a 14 day period ending on 9/1/2010. Android Platform Percent of Devices Android 1.5 (3) 12.0% Android 1.6 (4) 17.5% Android 2.1 (5,6,7) 41.7% Android 2.2 (8) 28.7%
  • 5. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. API Level <uses-sdk android:minSdkVersion=“<API Level>” android:targetSdkVersion=“<API Level>”/> minSdkVersion • Required; defaults to 1 indicating your app is compatible with all versions of Android. Use caution! • Set to the lowest possible number of the platform you want to deploy your application on • Used by adb when app is installed to verify device is running at same API level or higher (for example sideways install) • Also used by Android Market to filter what applications are available on devices
  • 6. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. API Level (con’t) <uses-sdk android:minSdkVersion=“<API Level>” android:targetSdkVersion=“<API Level>”/> targetSdkVersion • Optional; set to API level that application has been tested against • Enables or disables compatibility mode – targetSdkVersion = 3 • Want app to look the same on all devices and display at 160 • However, defaults for other manifest values will preclude app from QVGA devices – targetSdkVersion > 3 • Want app to run at resolution of device; avail on all screens sizes
  • 7. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Differentiating Areas • Platform Version – SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2 • Display – QVGA vs HVGA vs WVGA • Orientation – Landscape or Portrait • Camera – Flash and Focus
  • 8. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Display • QVGA vs HVGA vs WVGA/FWVGA? • Size doesn’t matter (well sort of doesn’t matter) • Density does matter – Device Independent Pixels (dip or dp /density independent) – Physical pixels – Logical Density : Scale factor between DIP and PIX • Density determines what the application looks like across devices • You can determine what density your app runs at through a few mechanisms
  • 9. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Range of Densities Logical Density Dpi (Resolution) Screen Size Android Devices 0.75 120 Small (QVGA) Motorola: -- FLIPOUT -- CHARM 1.0 160 Normal (HVGA) Motorola: -- CLIQ/DEXT -- Motorola i1 -- BACKFLIP 1.5 240 Large (WVGA) Motorola: -- DROID/Milestone -- DROID X
  • 10. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Coding for Different Displays • Enabling or disabling compatibility mode through your AndroidManifest file • Using density-independent pixel values in your application and pre-scaling your background • Including XML resources! • Creating multiple resource files at different densities and screen sizes • drawable-ldpi, drawable-mdpi, drawable-hdpi
  • 11. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Filtering on Display Sizes • Can limit the application from installing on devices with different screen sizes <supports_screens android:smallScreens=“true|false“ // qvga android:normalScreens=“true|false“ // hvga android:largeScreens=“true|false“ // wvga android:anyDensity=“true|false" /> // dpi • Market will block application from displaying on device where screensize = false
  • 12. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Differentiating Areas • Platform Version – SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2 • Display – QVGA vs HVGA vs WVGA • Orientation – Landscape or Portrait • Camera – Flash and Focus
  • 13. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Orientation • Two devices in our portfolio, CHARM and FLIPOUT, have a default orientation of landscape • Most keyboard enabled devices rotate to landscape when keyboard is opened • To account for different configurations, every application should: − Create layouts that handle rotation − Set the rotation behavior in your AndroidManifest file − Handle rotation in your application code by saving state or caching data
  • 14. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Orientation (con’t) • Create layouts that handle rotation ….
  • 15. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Orientation (con’t) • Let your activity auto-rotate <activity android:name=".MainActivity” android:label="@string/app_name” android:screenOrientation="unspecified" > • When an activity display rotates, the activity is destroyed and re-created. To avoid delay’s in reloading data….. − cache data before the screen rotates using onRetainNonConfigurationInstance() − restore it from onCreate() after rotation using getLastNonConfigurationInstance()
  • 16. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Sensor-Based Orientation • Additional tips for games that use the accelerometer or other motion-based sensors • Android Developer Blog • One Screen Turn Deserves Another http://android- developers.blogspot.com/2010/09/one-screen-turn-deserves- another.html • MOTODEV Technical Library • Handle Sensor-Based Screen Orientation http://developer.motorola.com/docstools/library/FLIPOUT_Pr ogramming_Tips/
  • 17. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Differentiating Areas • Platform Version – SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2 • Display – QVGA vs HVGA vs WVGA • Orientation • Landscape or Portrait • Camera – Flash or Focus
  • 18. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Camera • Many mass market devices will not have the same type of camera as a high-end smartphone • If your app manifest declares the CAMERA permission <uses-permission android:name=“CAMERA” /> • You should also specify <uses-feature android:name=“android.hardware.camera” /> • If you do not specify any uses-feature elements for camera, your app is assumed to use both autofocus and flash
  • 19. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Camera (con’t) • If your app does require either flash and/or autofocus capabilities, make sure you declare them <uses-feature android:name=“android.hardware.camera.autofocus ” /> <uses-feature android:name=“android.hardware.camera.flash” />
  • 20. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Differentiating Areas • Platform Version – SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1, SDK 2.1, SDK 2.2 • Display – QVGA vs HVGA vs WVGA • Orientation – Landscape or Portrait • Camera – Flash and Focus
  • 21. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. Device Configuration: How to tell? • Programmatically getting device configurations − android.content.res.Configuration − android.util.DisplayMetrics − android.os.Build etc……. • Technical Specifications page for every Motorola device − developer.motorola.com/products − As of today there are specs on 26 Android devices − Tracks between 50 – 60 configuration options that developers would be interested in
  • 22. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted.DEVELOPDESIGN DISCOVER DISTRIBUTE For More Information
  • 23. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. THANK YOU
  • 24. Copyright 2010 Motorola Mobility, Inc. All rights reserved unless otherwise noted. License • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. • Portions of this presentation are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

Editor's Notes

  1. Software Differences Platform Versions Densities and Compatibility Mode Hardware Differences Device Configurations So lets get started. Here I’ve listed 4 different devices and the some of the features that vary across different Android handsets. 1. Platform Version SDK 1.1, SDK 1.5, SDK 1.6, SDK 2.0, SDK 2.0.1 2. Display QVGA vs HVGA vs WVGA 3. Orientation - Portrait or Landscape 4. Camera Flash and Focus
  2. Let’s start with Platforms. What does the landscape look like? Google now collects data on it’s platform numbers and publishes that data on a “Device Dashboard”. This data itself is collected from number of apps downloaded from the Android Market to each different OS version. May or may not be an accurate data point for your region but it does show that there are multiple releases of Android available in the consumer space. As more phones are released in your region you will start to see the same type of distribution. When each platform version is released, new features are added that will not be available on previous versions. Be aware of this.
  3. So lets look at the how you set the API Level. It’s specified in the &amp;lt;uses-sdk&amp;gt; element of the application manifest file. There are three properties associated with this tag. minSdkVersion=1 but application uses APIs at level higher may or may not work across phones. The app will install. The app will not run on platforms that don’t support newer APIs used in your application. The app will crash. Not good from a consumer standpoint to be allowed to install an application that will not work.
  4. This is where compatibility mode comes into play. Compatibility mode came along when Android began supporting high resolution screens (same time that 1.6 came out). If you set the targetSdkVersion to 3 or lower it means you want your application to look the same on all devices and display at a resolution of 160. It’s “compatibile” on all phones. If you set the targetSdkVersion to higher than 3 (4, 5, 6, 7) it means you want to run your app at the same density that’s on the phone. It could be 160, or 240. In order to set this, the build target must match or be greater than the targetSdkVersion.
  5. Size of the screen doesn’t matter, it’s the density that matters. The density affects the scaling of your application. There are 3 components which are the building blocks for building graphical components.
  6. Because the first Android devices were running at a 160 resolution, Google has defined 160 as a “normal” or baseline value from which all other densities are compared. 160 * .75 = 120 160 * 1.5 = 240 Applications created against SDKs at API levels 1, 2, and 3 only run at a density of 160 no matter what device they run on. The property you need to set for the other densities does not exist in these SDKs. This property was introduced in SDK 1.6. Applications created against SDKs at API level 4 and above have the option of running at a density of 160 _OR_ the native density of the device. Apps running at a density of 160 on all devices are said to be running in compatibility mode. This is independent of the device you are running on. Applications running at the density of the device are not running in compatibility mode.
  7. There are three ways to code for the different densities…….. Compatibility Mode On (runs at density of 1.0/160 dpi) Your application looks/runs the same on different resolutions Tells platform to automatically scale Compatible on all resolutions Issues with new tablets Compatibility Mode Off (runs at density of device) Your application looks/runs differently on different resolutions Tells platform that you want to control the display and scaling It is optimized for higher resolution; looks okay on lower resolution devices
  8. &amp;lt;supports_screens&amp;gt; tag does not exist in SDK 1.5 or earlier but the framework uses default values for these settings with apps that are built against SDK 1.5 or lower. If you are compiling your application against a build target of 1.6 or higher, then you need to explicitly set these values. anyDensity == true disables auto-scaling by framework and relies on application to use dp or scaled values anyDensity == false tells framework to try and scale application to fit display – works ok on high res screens, not as well on low res screens.
  9. In your res/layout/main.xml and res/layout-land/main.xml file specify where the UI elements should go relative to each other and to the dimensions For instance, in layout/main.xml you can get away with LinearLayout where the buttons place from top to bottom. However in layout-land/mail.xml it may be better to use RelativeLayout and position the buttons in relationship to each other.
  10. In onRetainNonConfigurationInstance() implementation, initialize variables or arrays with data that you want to preserve for your future-self. Then in your onCreate() method call getLastNonConfigurationInstalnce(). If not null you can pull the data from the preinitialized variables or arrays.
  11. In onRetainNonConfigurationInstance() implementation, initialize variables or arrays with data that you want to preserve for your future-self. Then in your onCreate() method call getLastNonConfigurationInstalnce(). If not null you can pull the data from the preinitialized variables or arrays.
  12. Specs categories: General data (platform version, navigation type) Display-specific data (resolution, physical screen) Connectivity (voice bands, bluetooth profiles) Multimedia data (supported media formats) Processor and Memory data (chipset, RAM and ROM values) Sensor data (Types supported) Additional information (supports flash or LBS) Coming soon: Graphics (openGL extensions)