android application development
DESCRIPTION
Slides used in the CSI's Workshop on Android Application Development. Deals from beginner to intermediate level of expertise..TRANSCRIPT
![Page 1: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/1.jpg)
Workshop on Android Application Development
Ganesh Babu,
IV Yr, BE, CSE,
SSN College of Engineering, Chennai
Narendran Thangarajan,
IV Yr, BE, CSE,
SSN College of Engineering, Chennai
+ =
![Page 2: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/2.jpg)
Why are we here? The Mobile OS family
Why Android
Android Architecture
Dalvik Virtual Machine
Setting up the environment
Views, Activities and Intents
Hands on sessions
Switching between Activities
The Legendary ”Hello World” App
Using SQLite DB
StickPad – Notes application
Oauth
JustTweet – A simple Twitter Client
![Page 3: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/3.jpg)
Why Mobile phones?
The increasing importance of mobile devices due to the lowering prices and flamboyant features.
The inception of the iPhone, Apple started this mobile OS revolution. (Jan 9, 2007)
In November 2007, Google formed the Open Handset Alliance to bring out the Android OS.
Then slowly Nokia, RIM and Microsoft made their way into the Mobile OS domain.
![Page 4: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/4.jpg)
Mobile OS family
Row 1 Row 2 Row 3 Row 40
2
4
6
8
10
12
Column 1Column 2Column 3
![Page 5: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/5.jpg)
Why Android?
Because its cool! :P Ok.. just kidding..
MultiTasking is more advanced Android App market is much bigger Android allows you to choose the hardware Android allows you to choose your carrier And Android has a huge community base..
![Page 6: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/6.jpg)
Android dominance in the market
Android clearly holds the lead with 43% market share.
The main reason is Android being open source.
![Page 7: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/7.jpg)
Android Architecture
![Page 8: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/8.jpg)
Android Applications - Gist
Written in Java Compiled to bytecode Tool named dx converts bytecode to .dex code
(Dalvik Executables) Dex files are executed by Dalvik Happily everafter :)
![Page 9: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/9.jpg)
Dalvik Virtual Machine
A register-based process virtual machine designed and written by Dan Bornstein
Usually called the JVM - #EpicFail Dalvik operates on Dex code and not Java
bytecode. Aim of Dalvik is that it should run on
Slow CPU Little RAM OS without swap space While powered by a battery
![Page 10: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/10.jpg)
Setting up the environment
![Page 11: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/11.jpg)
SQLite DB
What is SQLite? SQL +Lite → 275 kb C Source code Self Contained → Doesn't need external libraries Serverless → Doesn't run as a separate process Zero Configuration → SQLite Just works Transactional → Satisfies ACID rules
http://www.sqlite.org/atomiccommit.html Powers – Firefox, iPhones, Skype, Symbian OPEN SOURCE :)
http://www.sqlite.org/download.html
![Page 12: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/12.jpg)
SQLite Queries and Datatypes
Queries (Demo) Create Read Update Delete
DataTypes - Five NULL INTEGER REAL TEXT BLOB
![Page 13: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/13.jpg)
The Major differences
No GRANT and REVOKE
No ALTER TABLE
No editable VIEWS
No JOIN operation
![Page 14: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/14.jpg)
SQLite on Android SQLiteOpenHelper
override the methods onCreate() to create the database OnUpgrade() to change the schema
provides the methods DB Based
getReadableDatabase() getWriteableDatabase()
Querying rawQuery() Query()
Cursor-based getCount() moveToFirst() moveToNext()
![Page 15: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/15.jpg)
SQLiteDatabase - Demo
Schema → namelist [ id | name ] Create & Upgrade
db.execSQL()
Insert, Update, Delete db.insert() db.update() db.delete()
Read db.rawQuery()
![Page 16: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/16.jpg)
Stick Pad
![Page 17: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/17.jpg)
Using APIs - OAuth
Social Networking sites are ruling us! We use lots of third-party applications – are we
secure? OAuth to the rescue! Oauth provides a method for users to grant
third-party access to their resources without sharing the passwords.
Inspired from Google AuthSub,Yahoo BBAuth and Flickr API
![Page 18: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/18.jpg)
OAuth
TERMINOLOGY Oauth's Love Triangle
Client Server Resource Owner
Logging into an application without the application knowing your username and
password.
![Page 19: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/19.jpg)
Traditional Authentication
Client uses its credential to access its resources hosted on the server.
![Page 20: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/20.jpg)
Oauth Authentication
The Resource Owner is the person using the web application.
Client is the Web Application itself
![Page 21: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/21.jpg)
Oauth Authentication
The client is split into Front-end and Back-end
![Page 22: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/22.jpg)
Oauth Specification
http://hueniverse.com/oauth/guide/workflow/
Resource Owner – Jane Client – Beppa Server - Faji
![Page 23: Android application development](https://reader034.vdocument.in/reader034/viewer/2022052523/5551812eb4c9057f478b5489/html5/thumbnails/23.jpg)
Three credentials
Client Credentials Created when the Application was originally created
Temporary Credentials Created when the Resource Owner has to
authenticate himself to the server. Server will say that the client is requesting access
to private files.
Access Credentials Used by client to access the private resources in
the server.