subtitle touch | title of presentation | date dd/mm/yyyy touch cloud android sdk ghady rayess –...

40
Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th , 2013

Upload: abel-holmes

Post on 26-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Touch CloudAndroid SDK

Ghady Rayess – Jan 19th, 2013

Page 2: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Introduction to AndroidAndroid Operation System

o Android is an operating system based on Linux with a Java programming interface.

o The Android Software Development Kit (Android SDK) provides all necessary tools to develop Android applications.

o This includes a compiler, debugger and a device emulator, as well as its own virtual machine to run Android programs.

Page 3: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Introduction to AndroidGoogle Play

o Google Play is the premier store for distributing Android apps.

o It’s preinstalled on more than 400 million devices worldwide, a number growing by more than a million every day.

o Android users have downloaded more than 25 billion apps from Google Play, growing at a rate of more than 1.5 billion per month.

Page 4: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Introduction to AndroidQuick facts

Page 5: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectAndroid versions

Version Code name Release date API level Distribution4.2 Jelly Bean 13-Nov-12 17 0.80%4.1.x Jelly Bean 9-Jul-12 16 5.90%4.0.x Ice Cream Sandwich 16-Dec-11 15 27.50%3.2 Honeycomb 15-Jul-11 13 1.20%3.1 Honeycomb 10-May-11 12 0.40%2.3.3–2.3.7 Gingerbread 9-Feb-11 10 50.60%2.3–2.3.2 Gingerbread 6-Dec-10 9 0.20%2.2 Froyo 20-May-10 8 10.30%2.0–2.1 Eclair 26-Oct-09 7 2.70%1.6 Donut 15-Sep-09 4 0.30%1.5 Cupcake 30-Apr-09 3 0.10%

Page 6: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Android Development ToolsAndroid SDK

o The Android Software Development Kit (SDK) contains the necessary tools to create, compile and package Android application.

o The Android SDK also provides an Android device emulator, so that Android applications can be tested without a real Android phone.

o You can create Android virtual devices (AVD) via the Android SDK, which run in this emulator.

o The Android SDK contains the Android debug bridge (adb) tool which allows to connect to an virtual or real Android device.

Page 7: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Android Development ToolsSDK Manager: For managing/updating available SDKs

Page 8: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Android Development ToolsAVD Manager: Creating/Managing Virtual Devices

Page 9: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Android Development ToolsAndroid Emulator

Page 10: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Hello WorldCreating a Project

File -> New -> Android Application ProjectProceed with default values

Page 11: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Hello WorldActivities, XML Layout Files, Values: Strings

Page 12: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Hello WorldActivities

Page 13: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Hello WorldXML Layout Files: Graphical Layout & xml code

Page 14: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Hello WorldResources: Strings

Page 15: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Apstrata Android SDKApstrata Client

http://wiki.apstrata.com/display/doc/Android+SDK

Page 16: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Apstrata SDKApstrata Client

o Signed with username/password:ApstrataClientAndroid(String baseUrl, String key, String user, String password, AuthMode authMode)

o Signed with secret:ApstrataClientAndroid(String baseUrl, String key, String secret, AuthMode authMode)

o Unsigned:ApstrataClientAndroid(String baseUrl, String key, AuthMode authMode)

Page 17: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Apstrata SDKAPI Calls

o JSON Response:String callAPIJson(String methodName, List<NameValuePair> params, Map<String, List<File>> files)

o XML Response:public String callAPIXml(String methodName, List<NameValuePair> params, Map<String, List<File>> files)

Page 18: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Apstrata SDKParameters

o Passed to API Calls asList<NameValuePair> params

o Creating a List of <NameValuePair>

List<NameValuePair> parameters = new ArrayList<NameValuePair>();parameters.add(new BasicNameValuePair(param1Key, param1Value));parameters.add(new BasicNameValuePair(param1Key, param1Value));

Page 19: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Apstrata SDKFiles

o Passed to API Calls asMap<String, List<File>> files

o Creating a Map of <String, List<File>>

List<File> files = new ArrayList<File>();list.add(myFile1);list.add(myFile1);Files.put(filesKey, files);

Page 20: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Apstrata ExampleIn HelloWorldProject:Part A: Making Apstrata Call – In MainActivity.java:• Create ApstrataClient using username and password from previously created

Asptrata account• Choose an Apstrata API for testing• Create parameters and files• Call Asptrata API• Log Result

Part B: Displaying Result in TextView• Create a new TextView in activity_main.xml• Obtain reference to TextView in MainActivity.java• Display Apstrata API result in TextView

Page 21: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Apstrata ExamplePart 1 Code

Page 22: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectOverview

Buy tickets

Upload images

Choose a concert

Concert A

Concert B

Concert C

Choose a concert

Concert A

Concert B

Concert C

Concert A

Buy

+ - # tickets

Total $$

Concert A

Upload an image

img1 img2 img3

img4 img5

Save

Title

Desc

Tags

Page 23: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 1: Get List of Concerts

ConcertsActivity• Send Request to get list of concerts in JSON format• Parse received JSON response• Populate a list of Concerts

• Show received concerts in ListView

Concert• key: String• title: String• ticketPrice: double• description: String• date: Date• documentKey: String• picture: String• pictureUrl: String

Page 24: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 1: Get List of Concerts

Eclipse [String getConcerts()]

Page 25: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 1: Get List of Concerts – Solution

http://www.foo.mobi/cloud/ConcertsActivity.java

Page 26: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 1: Get list of concerts – Sample Response

{"response":{"metadata":

{"requestId": "8f401989-515b-4204-a539-7239769c93ce","status": "success","statusCode": "200"},

"result": {"documents": [{"key": "DavidGuattoConcert","versionNumber": "1.0","title": "David Guatto gone wild","ticketPriceLL": "80000.0","picture": "DavidGuattoGoneWild.jpg","description": "Best Techno event of the year","date": "2012-11-23T00:00:00+0000","apsdb.documentKey": "DavidGuattoConcert"},…….]

}}

}

Page 27: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 2: Buy a Concert Ticket

BuyTicketsActivity• Populate user interface with concert parameters

• When user clicks Buy, send request with the following: name, msisdn, unitPrice, quantity, concertTitle

• Parse received JSON response

• Show success or fail message

Page 28: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 2: Buy a Concert Ticket

Eclipse [String buyConcertTicket ()]

Page 29: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 2: Buy a Concert Ticket – Solution

http://www.foo.mobi/cloud/BuyTicketsActivity.java

Page 30: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 2: Buy a Concert Ticket – Sample Response

{"response":{"metadata":

{"requestId": "181eef41-42fd-457f-a106-1135379762a9","status": "success","statusCode": "200"},

"result":{"status": "success", "transactionId": "b5077a0f-7a10-45e0-a97f-8d913281647d"

}}

}

Page 31: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 3: Get Concert Gallery Images

ConcertGalleryActivity1. Send Request to get list of concert images in JSON format

2. Parse received JSON response

3. Show received images in GridView

GalleryImage• key: String• title: String• picture: String• pictureUrl: String

Page 32: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 3: Get Concert Gallery Images

Eclipse [String getConcertGallery ()]

Page 33: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 3: Get Concert Gallery Images – Solution

http://www.foo.mobi/cloud/ConcertGalleryActivity.java

Page 34: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 3: Get Concert Gallery Images – Sample Response

{"response":{"metadata":

{"requestId": "8bfd1716-0e99-48ec-a4fd-129a04bf0abb","status": "success","statusCode": "200"},

"result": {"documents": [{"key": "image4","versionNumber": "1.0","picture": "DavidGuatto2.jpg", "title": "pic4"},

{"key": "image3","versionNumber": "1.0","picture": "DavidGuatto1.jpg","title": "pic3"}]

}}

}

Page 35: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 4: Upload an Image to a Concert

ImageUploadActivity1. User captures an image or selects one from phone gallery

2. User fills fields for image title, description, and tags

3. When user clicks Save, send request with the following parameters: title, description, tags, concert; and the file: picture

4. Parse received JSON response

5. Show success or fail message

Page 36: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 4: Upload an Image to a Concert

Eclipse [String uploadImageToConcert ()]

Page 37: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 4: Upload an Image to a Concert – Solution

http://www.foo.mobi/cloud/ImageUploadActivity.java

Page 38: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

Concerts ProjectExercise 4: Upload an Image to a Concert – Sample Response

{"response":{"metadata":

{"requestId": "181eef41-42fd-457f-a106-1135379762a9","status": "success","statusCode": "200"},

"result":{"status": "success", "transactionId": "b5077a0f-7a10-45e0-a97f-8d913281647d"

}}

}

Page 39: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY

THANK YOU!

Page 40: Subtitle touch | Title of presentation | Date DD/MM/YYYY Touch Cloud Android SDK Ghady Rayess – Jan 19 th, 2013

Subtitle

touch | Title of presentation | Date DD/MM/YYYY