Android application development


Published on

Slides used in the CSI's Workshop on Android Application Development. Deals from beginner to intermediate level of expertise..

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Android application development

  1. 1. Workshop on Android Application Development + = Narendran Thangarajan, Ganesh Babu, IV Yr, BE, CSE, IV Yr, BE, CSE, SSN College of Engineering, SSN College of Engineering, Chennai Chennai
  2. 2. 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
  3. 3. 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.
  4. 4. Mobile OS family 12 10 8 Column 1 6 Column 2 Column 3 4 2 0 Row 1 Row 2 Row 3 Row 4
  5. 5. 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..
  6. 6. Android dominance in the market Android clearly holds the lead with 43% market share. The main reason is Android being open source.
  7. 7. Android Architecture
  8. 8. 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 :)
  9. 9. 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
  10. 10. Setting up the environment
  11. 11. SQLite DB What is SQLite?  SQL +Lite → 275 kb C Source code  Self Contained → Doesnt need external libraries  Serverless → Doesnt run as a separate process  Zero Configuration → SQLite Just works  Transactional → Satisfies ACID rules   Powers – Firefox, iPhones, Skype, Symbian  OPEN SOURCE :) 
  12. 12. SQLite Queries and Datatypes Queries (Demo)  Create  Read  Update  Delete DataTypes - Five  NULL  INTEGER  REAL  TEXT  BLOB
  13. 13. The Major differences No GRANT and REVOKE No ALTER TABLE No editable VIEWS No JOIN operation
  14. 14. 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()
  15. 15. SQLiteDatabase - Demo Schema → namelist [ id | name ] Create & Upgrade  db.execSQL() Insert, Update, Delete  db.insert()  db.update()  db.delete() Read  db.rawQuery()
  16. 16. Stick Pad
  17. 17. 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
  18. 18. OAuth Logging into an application without the application knowing your username and password. TERMINOLOGY Oauths Love Triangle  Client  Server  Resource Owner
  19. 19. Traditional Authentication Client uses its credential to access its resources hosted on the server.
  20. 20. Oauth Authentication The Resource Owner is the person using the web application. Client is the Web Application itself
  21. 21. Oauth Authentication The client is split into Front-end and Back-end
  22. 22. Oauth Specification Resource Owner – Jane Client – Beppa Server - Faji
  23. 23. 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.