Post on 03-Jul-2015
transcript
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
Contents
• Starting with Android
• Starting the project
• OSN formats: XML vs. JSON
• OSN Android library overview
• Get this presentation: http://kcy.me/9bin
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
APK
Android applications
Activity A1 Activity A2 Activity B1
APK
APK
ServiceContent provider
Broadcast receiver
Widget Activity C1
Ap
plic
atio
n 1
Ap
plicatio
n 2
Application 1 Stack
Activity A1
Activity A2
Activity B1
More info about Android
• http://developer.android.com
• http://forum.xda-developers.com/
• http://vogella.de
Include libraries
• GSON: serialize and deserialize objectsto/from JSON.http://code.google.com/p/google-gson/
• SimpleXML: serialize and deserialize objectsto/from JSONhttp://simple.sourceforge.net/
Get OSNLibrary
• http://code.google.com/p/osn-samples/
• Package com.tempos21.opencities.osn
• Folder /src/com/tempos21/opencities/osn
XML & JSON
• Both are text formats
• Used to store and transfer information
• Several variants and associated technologies
XML
• (X)HTML is a subset of XML
• Based on tags <XXX>…</XXX>
• Validate through schema (DTDXSD)
• Separates data and metadata
• Great support for internationalization
• http://www.w3schools.com/xml/
JSON
• Usually content is lighter
• Faster (and easier) to parse
• Simplest format
• http://json.org/
ComparisonXML<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<description>An in-depth look at creating applications with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description>
</book>
</catalog>
JSON{"catalog":
{"book": [
{
"@attributes": {"id":"bk101"},
"author":"Gambardella, Matthew",
"title":"XML Developer's Guide","description":"An in-depth look at creating applications with XML.“
},
{
"@attributes":{"id":"bk102"},
"author":"Ralls, Kim",
"title":"Midnight Rain",
"description":"A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.“
}
]}
}
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
Team
• Project Manager: Ana Martínez
• Android: Sergi Martínez & Tager Hammoud
• iOS: Luis López
• Windows Phone: Raul Rodríguez
What contains the library?
• A set of beans designed to fit the data fromOSN
• A set of helpers used to call the services and transform the answer into beans
HttpUtil
• HttpUtil.downloadString
• HttpUtil.parseJSON
• HttpUtil.parseXML
• downloadJSON = downloadString + parseJSON
• downloadXML = downloadString + parseXML
Getting more information
• http://opencities.upf.edu/osnweb/
• https://wikis.dtic.upf.edu/wikis/opencities/
• http://opencities.net
Making questions
• Forum: http://support.opencities.upf.edu/
• Communities: – Catdroid.org
– GTUG
– NSCoders
– BJUG
– BCN.net
– Etc……..
QUESTIONS
Download this presentation: http://kcy.me/9bin