Osn android library

679 views

Published on

Published in: Technology, News & Politics
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
679
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Osn android library

  1. 1. About me• Sergi Martínez• +2 years working on Android• +15 years working on development• Android Dev Team Lead at Tempos 21• Co-founder of Catdroid (Catalonian Android community)• Follow-me at @sergiandreplace
  2. 2. Contents• Starting with Android• Starting the project• OSN formats: XML vs. JSON• OSN Android library overview• Get this presentation: http://kcy.me/9bin
  3. 3. STARTING WITH ANDROIDThe quickest introduction to Android you’ve ever seen
  4. 4. Installing the environment• developer.android.com/sdk/installing.html• Install Eclipse 3.6/3.7/3.8• Download Android SDK• Install ADT plugin for eclipse• Add platforms and packages
  5. 5. Android applications Application 1 StackApplication 1 Activity A1 Activity A2 Activity B1 Activity B1 APK Content Service Activity A2 provider Application 2 Broadcast Activity A1 Widget Activity C1 receiver APK APK
  6. 6. Activities lifecycle
  7. 7. More info about Android• http://developer.android.com• http://forum.xda-developers.com/• http://vogella.de
  8. 8. STARTING OUR PROJECTThat means lunchtime is coming!
  9. 9. Create a new project
  10. 10. Include libraries• GSON: serialize and deserialize objects to/from JSON. http://code.google.com/p/google-gson/• SimpleXML: serialize and deserialize objects to/from JSON http://simple.sourceforge.net/
  11. 11. Get OSNLibrary• http://code.google.com/p/osn-samples/• Package com.tempos21.opencities.osn• Folder /src/com/tempos21/opencities/osn
  12. 12. OSN FORMATS: XML VS. JSON
  13. 13. XML & JSON• Both are text formats• Used to store and transfer information• Several variants and associated technologies
  14. 14. XML• (X)HTML is a subset of XML• Based on tags <XXX>…</XXX>• Validate through schema (DTDXSD)• Separates data and metadata• Great support for internationalization• http://www.w3schools.com/xml/
  15. 15. JSON• Usually content is lighter• Faster (and easier) to parse• Simplest format• http://json.org/
  16. 16. ComparisonXML JSON {"catalog":<?xml version="1.0"?> {"book": [<catalog> { <book id="bk101"> "@attributes": {"id":"bk101"}, <author>Gambardella, Matthew</author> "author":"Gambardella, Matthew", <title>XML Developers Guide</title> "title":"XML Developers Guide","description":"An in-depth look at <description>An in-depth look at creating creating applications with XML.“ applications with XML.</description> }, </book> { <book id="bk102"> "@attributes":{"id":"bk102"}, <author>Ralls, Kim</author> "author":"Ralls, Kim", "title":"Midnight Rain", <title>Midnight Rain</title> "description":"A former architect battles <description>A former architect battles corporate zombies, an evil sorceress, and her corporate zombies, an evil sorceress, and her own childhood to become queen of the own childhood to become queen of the world.“ world.</description> } </book> ]} }</catalog>
  17. 17. Which one to choose?• There is no definitive answer• JSON is often more used for web services due to smallest files to transfer• You can retrieve both for OSN services• A good idea is to use same format than sensor output in order to use same parser in all the code
  18. 18. OSN LIBRARY OVERVIEWAfter all this time, we start now with the main topic…
  19. 19. Team• Project Manager: Ana Martínez• Android: Sergi Martínez & Tager Hammoud• iOS: Luis López• Windows Phone: Raul Rodríguez
  20. 20. What contains the library?• A set of beans designed to fit the data from OSN• A set of helpers used to call the services and transform the answer into beans
  21. 21. BeansServiceContainer EntryContainer JSON only Service Entry JSON + XML Resource Extras
  22. 22. HttpUtil• HttpUtil.downloadString• HttpUtil.parseJSON• HttpUtil.parseXML• downloadJSON = downloadString + parseJSON• downloadXML = downloadString + parseXML
  23. 23. RETRIEVING SERVICE METADATA USINGTHE OSN ANDROID LIBRARYALT+TAB
  24. 24. RETRIEVING SERVICE DATA USING THEOSN ANDROID LIBRARYALT+TAB
  25. 25. EXTRAS
  26. 26. Getting more information• http://opencities.upf.edu/osnweb/• https://wikis.dtic.upf.edu/wikis/opencities/• http://opencities.net
  27. 27. Making questions• Forum: http://support.opencities.upf.edu/• Communities: – Catdroid.org – GTUG – NSCoders – BJUG – BCN.net – Etc……..
  28. 28. QUESTIONSDownload this presentation: http://kcy.me/9bin

×