Top Banner
By- SitCom Solutions AN INTRODUCTION TO ANDROID APP DEVOLOPMENT
30

Android app devolopment

Jul 16, 2015

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Android app devolopment

By-

SitCom Solutions

AN INTRODUCTION TO

ANDROID APP DEVOLOPMENT

Page 2: Android app devolopment

Overview• What we will cover ?

What is android?

Setting up Development Environment

Project Structure

Activity

UI and Layouts

Services

Broadcast Receivers

Deployment 1st Phase

Page 3: Android app devolopment

Introduction

Android Background

Android Architecture

Android Applications

APIs

Security and Permissions

The Android Market

Page 4: Android app devolopment

Android Background• Mobile Operating System developed by Android Inc

Google bought in 2005

• Based on Linux Kernel

• Open Source

• Built on Idea of being open

All applications are equal

Everything is swappable

• Application Layer is Java

• Has built in Google Market for Applications

• The first commercially available Smartphone running Android was the HTC Dream, released on October 22, 2008

• Source Code released under Open Source

Page 5: Android app devolopment

Android Background• Supports a multitude of

devices

• Growth Rate since it entered into mobile world

Page 6: Android app devolopment

Android Architecture

Page 7: Android app devolopment

Android Architecture• Linux Kernel

• Libraries

Page 8: Android app devolopment

Android Architecture• Application Framework

• Applications

Page 9: Android app devolopment

Android Applications• Loosely coupled set of Service

• Contains

• Activities

• Services

• Broadcast Receivers

• Content Provider

• Can use other applications if

required

• Written in Java.

• Implements the “principle of least privilege”

Page 10: Android app devolopment

APIs• Android API level corresponds to particular Android OS

version

Other APIs

Location

Services

Telephony

Google Maps

Audio and

Video

Page 11: Android app devolopment

Security and Permissions

• Each application is provided a unique Linux User ID

• Each App lives in its Security Sandbox

• Each App has access to privileges required by it

• Apps needs to take permissions to access end user

facilities required by an application

• Applications can share resources and data through

Intents.

Page 12: Android app devolopment

The Android Market

•Direct access from phone and web•Open

•No approval•Not Policed

•Other markets also available•Cost

•One time 25$ fees to be an android developer•30% of cost at which application is sold

Page 13: Android app devolopment

Setting Up Development Environment

• You can develop on different OS using different IDE’s.

Page 14: Android app devolopment

Setting Up Development Environment

• Long Way so First things first

• IDE

• Download an IDE say Eclipse

• Go to www.Eclipse.org and select download for Java environment

• Extract it to a folder in C:\ with a name of your choice

• JDK and JRE

• Download Java Development Kit and Java Runtime Environment

• Install and Create Environment variables for java compilation.

Page 15: Android app devolopment

Setting Up Development Environment

• Download Android SDK

• Go to http://developer.android.com/sdk/installing/index.html

• Run SDK manager from root folder and install all packages you require to develop for.

Page 16: Android app devolopment

• Download and install ADT fro IDE here Eclipse

• Open Eclipse-> Click on Help-> Click on Install new Software

• On next popup Window click on->ADD

• Type a name Android and URL-https://dlssl.google.com/android/eclipse/

• On next window select all to install and click->Next

• Configure ADT

• Click on Window->Preferences

• Now select Android from Left Panel and browse sdk location from right to place where you downloaded android sdk.

Setting Up Development Environment

Page 17: Android app devolopment

Let’s Create an Android Project• To do this Open Eclipse or your IDE and click on File-

>New->Other/Android Project

• If Other than select from popup window Android Project

Page 18: Android app devolopment

Let’s Create an Android Project• Next select activity for your app and an icon.

Page 19: Android app devolopment

First Page

Page 20: Android app devolopment

Project Structure

Page 21: Android app devolopment

Android Manifest File• Must be available to all apps in root directory.

• Describes all Components of an Application

• Activities

• Permissions

• Services

• Data

• Intent Filter

• Application

• SDK version

• And many more to explore

Page 22: Android app devolopment

Activities

• Backbone

• Main Entrance when started is Main Activity

• Sub Class of Activity class

• Activity state preserved in “Back Stack”

Page 23: Android app devolopment

Activities Lifecycle

Page 24: Android app devolopment

Activities -What we can do with it?

• Create Views

• Get and Update Views

• Respond to View Events using “Intents”

• Create and Launch Activities

• Save Activity State

• Control how our Application responds.

• We can add “Fragments” to Activities.

Page 25: Android app devolopment

Views and Layouts ! What are these?

• Everything in android UI is a View because-

• View is an overloaded word

• Layouts

• Android Widgets

• UI

• Pass object to Activity and

it draws for us

• View Object

• XML Layout File

Page 26: Android app devolopment

Layouts• XML representation of View Objects

• Are typically ViewGroups

• Linear Layout

• Relative Layout

• Table Layout

• Absolute Layout

• Other Layouts

• List Views

• Grid Views

• Tab View

• And lot more to Explore

Page 27: Android app devolopment

Services• Runs in background, No UI

• Two Types

• Bound (runs till activity lives)

• Unbound (runs indefinitely)

• Service Lifecycle

Page 28: Android app devolopment

Broadcast Receivers• Responds to System Wide Broadcast announcements

• Can be

• Static

• Dynamic

• Some System Broadcasts are

• Low Battery notification

• Memory Full etc.

Page 29: Android app devolopment

Deployment• Sign your Application with your Private key

• Right Click on Project

• Go to Android Tools->Export Signed Application

• Fill the details

• Obfuscate with Proguard

• In order to diminish the misuse of your code use it.

• Open Source Java Tool in ADT

• Prevents code to be meaningfully Decompiled.

• Just add a line in default.properties

• Proguard.Config=proguard.cfg

• Export from Eclipse or other IDE

• And you are with a “.apk” file.

Page 30: Android app devolopment