73
Introduction au développement d'applications mobiles

Introduction à Android - Mars 2012

Embed Size (px)

Citation preview

Page 1: Introduction à Android - Mars 2012

Introduction au développement d'applications mobiles

Page 2: Introduction à Android - Mars 2012

Ma formation, mon expérience, mon entreprise

Page 3: Introduction à Android - Mars 2012

Présentation

Aurélien GuillardDéveloppeur Mobile multiplateforme

AndroidBlackberryiPhoneJ2ME

[email protected] [email protected] http://www.aurelienguillard.com

Twitter : @rorolepro (oui, je sais, ce pseudo est ridicule)

Page 4: Introduction à Android - Mars 2012

Expériences professionnelles

Acutellement : Viadeo (Android, BlackBerry)

2010 : Clicmobile (Android, iPhone, Blackberry, J2ME)

2009 : Latin 3G S.A. de C.V. (Android)

2008 : GAROS (web)

2007 : e-doceo (ActionScript)

2006 : SA2EI (web)

Page 5: Introduction à Android - Mars 2012

Viadeo

40 millions de membres

1 million de nouveaux

membres par mois

7 langues

Des locaux sur toute la planèteParis, San Francisco, New Delhi, Beijing, Amsterdam, Madrid, Moscou, Casablanca, Londres, Barcelone, Milan, Dakar, Mexico

400% de croissance ces 2 dernières années

400 salariés

3 marques :

Page 6: Introduction à Android - Mars 2012

Viadeo et moi

Inscrit depuis Février 2009

3500 visites sur mon profil

Environ 3 opportunités professionnelles par semaine

Mes 2 premières expériences professionnelles acquises grâce à Viadeo !

Envie de découvrir l'envers du décor !

Un produit que j'aime

Une réussite française

Une équipe internationale

Équipe mobile créée cet étéDéjà 9 personnes !

Page 7: Introduction à Android - Mars 2012

Viadeo sur mobile

Déjà présent sur iPhone, Android, WP7, Bada et Palm

Page 8: Introduction à Android - Mars 2012

Nouveaux produits mobiles

Application

BlackBerry

Android SDKhttp://dev.viadeo.com/documentation/tools-and-samples/android-sdk/

iPhone SDKhttp://dev.viadeo.com/documentation/tools-and-samples/iphone-sdk/

Page 9: Introduction à Android - Mars 2012

Viadeo graph API

Page 10: Introduction à Android - Mars 2012

Le métier au quotidien

Estimation

Conception et architecture

Développement applications et librairies

Tests

Corrections et améliorations

Veille technologique

Page 11: Introduction à Android - Mars 2012

Android ?

Page 12: Introduction à Android - Mars 2012

Android

Startup rachetée par Google en 2007

OS open-sourceTerminaux mobilesSystèmes embarqués

Développement Java/XML (SDK) C (NDK)

Page 13: Introduction à Android - Mars 2012

Une hausse constante

Page 14: Introduction à Android - Mars 2012

Les versions

Jelly Bean5.0 ???

Ice Cream Sandwich4.0 – 4.0.2 – 4.0.3

Honeycomb3.0 – 3.1 – 3.2

Gingerbread2.3 – 2.3.2 – 2.3.3 – 2.3.7

FroYo2.2

Eclair2.1

Donut1.6

Cupcake1.5

Data collected during two weeks ending on March 5, 2012

#K4Kouign : Support the choice of Kouign-Amann as the 'K' release of the Android Operating System

Page 15: Introduction à Android - Mars 2012

Les smartphones

SonyXperia X10 Mini

240x320

SamsungGalaxy S2480x800

HTCMagic

320x480

MotorolaMilestone480x854

SamsungGalaxy Nexus

720x1280

Page 16: Introduction à Android - Mars 2012

Les tablettes

AsusEeePad Transformer

1280x800

MotorolaXoom 2

1280x720

SamsungGalaxy Tab 10.1

1920x1080

SonyTablet S

1280x720

Page 17: Introduction à Android - Mars 2012

Les systèmes embarquées

People of LavaScandinavia

SamsungRF4289HARS

ParrotAsteroid

SonySmartWatch

LogitechRevue

(Google TV)

Page 18: Introduction à Android - Mars 2012

Boutons

HomeBack SearchMenu

Recents

Hardware keys

Virtual controls

Home BackMenu

HomeBack

Page 19: Introduction à Android - Mars 2012

Android != iPhone

UINavigationBarController

UITabController

Tentative de reproduction de

"controllers" iPhone...

Page 20: Introduction à Android - Mars 2012

Les éléments de UI (User Interface)

Page 21: Introduction à Android - Mars 2012

ScrollView + Options Menu

TextView

ScrollView

Options Menu(clic sur le

bouton physique "menu")

Page 22: Introduction à Android - Mars 2012

ProgressDialog

STYLE_SPINNER

Page 23: Introduction à Android - Mars 2012

Dialog

Custom dialog

TextView

EditText

Button

Page 24: Introduction à Android - Mars 2012

ImageView

ImageView

TextView

TextView

Page 25: Introduction à Android - Mars 2012

TabHost

TabWidget

FrameLayoutListView

Page 26: Introduction à Android - Mars 2012

MapView

Pas disponible dans le framework standard nécessite la lib Google APIs

com.google.android.maps.MapView

Page 27: Introduction à Android - Mars 2012

Outils de développement

Page 28: Introduction à Android - Mars 2012

Outils de développement

Eclipsehttp://www.eclipse.org/downloads/

ADT pluginhttps://dl-ssl.google.com/android/eclipse/

Android SDK (Windows, Linux, MacOS)http://developer.android.com/sdk/

Téléchargement des plateformes depuis le SDK and AVD Manager

Page 29: Introduction à Android - Mars 2012

SDK Manager

Page 30: Introduction à Android - Mars 2012

Création d'émulateurs

Page 31: Introduction à Android - Mars 2012

DDMS

Page 32: Introduction à Android - Mars 2012

Composition d'un projet Android

Page 33: Introduction à Android - Mars 2012

Arborescence d'un projet

Java

Images

XML

Strings

Manifest

FrameworkGenerated java files

Page 34: Introduction à Android - Mars 2012

Composants d'application

Activities

Services

Broadcast receivers

Content providers

Page 35: Introduction à Android - Mars 2012

Arborescence de l'application

PhotosetListActivity ContainerActivity

PhotosActivity

PhotosListActivity PhotosMapActivity

Page 36: Introduction à Android - Mars 2012

Intents

Système de messages pour exécuter un composant (activity, service, broadcast receiver)

Possibilité d'exécuter des composants d'une même application OU/ET d'applications différentes

Android tente de répondre le mieux à chaque Intent (explicit/implicit intents)

Page 37: Introduction à Android - Mars 2012

Activity life cycle

Page 38: Introduction à Android - Mars 2012

Manifest.xml

Permissions

Plateforme cible

Activities

Numéros de versions

Intent filters

Page 39: Introduction à Android - Mars 2012

Création des vues

Page 40: Introduction à Android - Mars 2012

Une vue est décrite en XML

Page 41: Introduction à Android - Mars 2012

Assigner un layout XML à une Activity

Generated Class File Type de ressource Nom de la ressource

Page 42: Introduction à Android - Mars 2012

XML Inflate

Page 43: Introduction à Android - Mars 2012

Gestion des ressources

Page 44: Introduction à Android - Mars 2012

Types de ressource

anim/

color/

drawable/

layout/

menu/

raw/

values/

xml/

Page 45: Introduction à Android - Mars 2012

Drawable auto-scaling

Même image, même nom de fichier, mais dans des dossiers

différents, chacun lié à une densité différente

(low, medium, high)

icon72x72

icon36x36

icon48x48

Page 46: Introduction à Android - Mars 2012

Resource qualifiers

MCC and MNC : mcc310 mcc310-mnc004 mcc208-mnc00 etc.

Langage and region : en fr en-rUS fr-rFR fr-rCA etc.

Screen size : small normal large xlarge

Screen aspect : long notlong

Screen orientation : port land

Dock mode : car desk

Night mode : night notnight

Screen pixel density : ldpi mdpi hdpi xhdpi nodpi

Touchscreen type : notouch stylus finger

Keyboard availability : keysexposed keyssoft

Primary text input method : nokeys qwerty 12key

Navigation key availability : navexposed navhidden

Primary non-touch navigation method : nonav dpad trackball wheel

System version (API level) : v3 v4 v7 etc.

Page 47: Introduction à Android - Mars 2012

Connexion à un WebService

Page 48: Introduction à Android - Mars 2012

Flickr API

Formats de requêteREST, XML-RPC, SOAP

Formats de réponseREST, XML-RPC, SOAP, JSON, PHP

Flickr App Gardenhttp://www.flickr.com/services/api/

Page 49: Introduction à Android - Mars 2012

Couches applicatives

WebServiceAPIManagerContentManagerActivity

savePhotos(id) getPhotos(id) flickr.photosets.getPhotos

File responseStringJava object

Page 50: Introduction à Android - Mars 2012

Réponse API Flickr

Page 51: Introduction à Android - Mars 2012

APIManager

Connexion à l'API REST Appel non signé, sans jeton d'utilisateur Méthode GET

Page 52: Introduction à Android - Mars 2012

ContentManager

Page 53: Introduction à Android - Mars 2012

Sauvegarde des données

Page 54: Introduction à Android - Mars 2012

Shared Preferences

Accès : privé

Type : primitif (boolean, float, int, long, string)

Format : clé/valeur

Utilisé pour sauvegarder des paramètres

Page 55: Introduction à Android - Mars 2012

Internal Storage

Accès : privé

Format : fichier

Page 56: Introduction à Android - Mars 2012

External Storage

Accès : public

Format : fichier

Nécessite des vérifications : média monté sur une machine, absent, accessible qu'en lecteur, etc.

Sauvegarder ses fichiers dans :/Android/data/<package_name>/files/

Page 57: Introduction à Android - Mars 2012

Databases

Accès : privé

Format : données structurées

Type : SQLite

Page 58: Introduction à Android - Mars 2012

SQLiteOpenHelper

Page 59: Introduction à Android - Mars 2012

Google Play (ex Android Market)

Page 60: Introduction à Android - Mars 2012

Client Google Play

Page 61: Introduction à Android - Mars 2012

Client Google Play

Page 62: Introduction à Android - Mars 2012

Google Play Admin

Page 63: Introduction à Android - Mars 2012

Upload Assets

Page 64: Introduction à Android - Mars 2012

Listing details

Page 65: Introduction à Android - Mars 2012

Publishing options

« If you want porn, get an Android » – Steve Jobs

Page 66: Introduction à Android - Mars 2012

Statistics

Page 67: Introduction à Android - Mars 2012

Liens

Page 68: Introduction à Android - Mars 2012

Documentation et examples

http://developer.android.com

http://developer.android.com/design/

http://android.cyrilmottier.com

http://www.androidpatterns.com

http://code.google.com/p/android-cookbook/

http://code.google.com/p/apps-for-android/

http://www.androidsnippets.org

Page 69: Introduction à Android - Mars 2012

Actualités

http://www.frandroid.com

http://www.pointgphone.com

Page 70: Introduction à Android - Mars 2012

Aide

http://stackoverflow.com/questions/tagged/android

http://www.anddev.org

http://forum.frandroid.com

http://forum.xda-developers.com

https://groups.google.com/group/paris-android-ug

Page 71: Introduction à Android - Mars 2012

Utilitaires

http://code.google.com/p/android-ui-utils/

http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html

http://www.droidthing.com

http://androiddrivers.net

Page 72: Introduction à Android - Mars 2012

Livres

Page 73: Introduction à Android - Mars 2012

Merci de votre attention !

J'ai hâte de tester vos applications;)