Slide 1

Slide 1 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Feed your Android with a REST client (all references are purely coincidental) Emanuele Palazzetti :: Google Developer Group

Slide 2

Slide 2 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Who am I? Emanuele Palazzetti  @palazzem  evonove.it/authors/palazzem  github.com/emanuele-palazzetti

Slide 3

Slide 3 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Do you know what GDG is?

Slide 4

Slide 4 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Google Developer Group - Perugia  @GDGPerugia  perugia.gtugs.org  [email protected]

Slide 5

Slide 5 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia What is Android? It's not a killing machine...

Slide 6

Slide 6 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia ...but something very cool!

Slide 7

Slide 7 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia More informations SDK is open source and is available for all main operative systems No license fees, no certification or registration required to develop your apps

Slide 8

Slide 8 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia More technical details It's based on kernel Linux 2.6 and on 3.x from Ice Cream Sandwich version (Android > 4.0) API used to build the Android system are the same that are used by developers Almost all of basic components can be replaced with your or 3rd party application (ex: Skype, Viber, WhatsApp, etc..). There are some exception to avoid security issues The code is open source released as Apache License 2.0

Slide 9

Slide 9 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Android  Java The entire operative system and all built-in and third party apps are built with Java language Doesn't use standard JVM but a Dalvik VM It is possibile to call C/C++ code via JNI Kivy framework allows to write Python applications

Slide 10

Slide 10 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia

Slide 11

Slide 11 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Application layer (Activity) An Activity is an application component that provides a screen with which users can interact (dial phone, photos,...) Each activity is given a window in which to draw its user interface. There is an Activity Stack where new activities are pushed on top Only one Activity at the same time can runs

Slide 12

Slide 12 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia

Slide 13

Slide 13 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Many other components Services AsyncTask Broadcast receivers Content providers ...

Slide 14

Slide 14 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Start speaking about workshop

Slide 15

Slide 15 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia What do I want? I have a web service which exposes some REST APIs I want to build and Android application which uses these APIs

Slide 16

Slide 16 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia About REST APIs We have resources with a global identifier (ex: URI) To manipulate you can use a standardized interface (ex: HTTP) We can use HTTP methods (GET, PUT, POST, DELETE) Tipically the returned information is JSON, XML, etc...

Slide 17

Slide 17 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Example {"message": "Hello world!"}

Slide 18

Slide 18 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Our APIs (Django application) http://students-exam.herokuapp.com/admin/ http://students-exam.herokuapp.com/api/exam/.json

Slide 19

Slide 19 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia What design pattern to use?

Slide 20

Slide 20 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia

Slide 21

Slide 21 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Don't use it!

Slide 22

Slide 22 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia

Slide 23

Slide 23 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Another pattern...

Slide 24

Slide 24 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia ...another one (a foo pattern)...

Slide 25

Slide 25 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia ...too many design patterns!

Slide 26

Slide 26 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Brilliant! Why not use a library for that?!

Slide 27

Slide 27 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Remember: Design patterns are really important!

Slide 28

Slide 28 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Volley library Used by Google inside Play Store Automatically schedule all network requests (even images) Provides transparent disk and memory caching Powerful cancellation request API https://android.googlesource.com/platform/frameworks/volley

Slide 29

Slide 29 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Android distribution http://developer.android.com/about/dashboards/index.html

Slide 30

Slide 30 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Workshop time! https://www.tofu.st/palazzem/Android_stuff/logo_unipg.png https://www.tofu.st/palazzem/Android_stuff/volley.zip

Slide 31

Slide 31 text

Feed your Android with a REST client Emanuele Palazzetti :: Google Developer Group Perugia Emanuele Palazzetti :: Google Developer Group  @palazzem  evonove.it/authors/palazzem  github.com/emanuele-palazzetti/HungryDroid