android basic presentation (introduction)

82

Upload: rahul-tripathi

Post on 16-Jul-2015

174 views

Category:

Mobile


1 download

TRANSCRIPT

Android Introduction

Near Field Communication (NFC) Overview

Google map and GPS

C2DM

Android Push notification

Current Project

MyC-Calling on the Way

What is Android ?

Android: How it came to be

Android Features

Android Architecture

Android Application Component

Android is a software stack for mobile devices that includes

Operating system

Middleware

Key mobile applications

Android SDK Provides the tool and APIs to developer for developing Application on android platform using JAVA programming language.

What is Android ?

Software Stack

Middleware

Key Application

OS

A simple and powerful SDK.

No fees for licensing, distribution, development .

Development over many platform Linux, Mac OS, windows .

Excellent documentation.

Based on Linux Kernel.

Led by Google and Developed by Open Handset Alliance (OHA).

Android The first complete, open and free mobile

platform Release in November 2007 Initially rumoured to be some kind of

Gphone

An Open Handset Alliance Project.

Android: How it came to be ?

Open Handset Alliance

Group of more that 30 technology and mobile companies developing Android

GoalAccelerate innovation in mobile and offer consumers a richer, less expensive, and better mobile experience.

Application framework enable reuse and replacement of components

Dalvik virtual machine optimized for mobile devices

Integrated browser based on the open source WebKit engine

Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification .

SQLite for structured data storage

Android Features

Media support for common audio, video, and image formats (MPEG4, MP3, AAC, AMR, JPG, PNG, GIF)

GSM Telephony (hardware dependent)

Bluetooth, EDGE, 3G, and Wi-Fi ,NFC(hardware dependent)

Camera, GPS, compass, and accelerometer (hardware dependent)

Android Architecture

Android Architecture

Relies on Linux Kernel 2.6 for core system services:

Memory and Process Management

Network Stack

Driver Model

Security

The Kernel also acts as an abstraction layer

between the Hardware and rest of the Software stack

.

Android Architecture

Android Includes a set of C/C++ Libraries

used by various component of android

system .

These libraries tells the device how to

handle different kinds of data.

The Android runtime layer which includes

set of core java libraries and DVM (Dalvik

Virtual Machine) is also located in same

layer.

Android Architecture

This layer includes set of base libraries that are required for java libraries. Every Android application gets its own instance of Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently and it executes files in executable (.Dex) optimized for minimum memory.

.Dex + Menifest = .Apk

Android Architecture

The application framework is a set of basictools with which a developer can build muchmore complex tools.

Android Architecture

Android has set of core applications including an email client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language.

Android ArchitectureAndroid Application

Component

ActivitiesServicesContent ProvidersBroadCast Receivers

Android ArchitectureAndroid Component

An activity provides a user interface for User as single screen of an application.

For example, an activity might present a list of menu items users can choose from or it might display photographs along with their captions. Each one is implemented as a

subclass of the Activity base class.

Android ArchitectureAndroid Application

Component

Android ArchitectureAndroid Application

Component

Android ArchitectureAndroid Application

Component

A service doesn't have a visual user interface,

but runs in the background for an indefiniteperiod of time.

For Example a service might play background musicas the user might fetch data over the network orcalculate some thing and provide the result toactivities that need it. Each service extends theService base class.

A service can essentially take two forms:

StartedBound

Android ArchitectureAndroid Application

Component

Started: A service is started when an

application component(such an activity)

starts by calling stratService(). Once

started, a service can run in backgroundindefinitely, even if thier component thatstarted it is destroyed.

Example : it might download or upload a file

over the network. When operation is done,the service should stop itself .

Android ArchitectureAndroid Application

Component

Bound: A service is Bound when an

application component(such an activity)Bind to it by calling BindService(). A bound

service runs only application component is

bound to it but when all of them unbind,

the service is destroyed

Example : In music player when we play any

song it start with audio and it bind with allactivity of application .it stop only whenapplication component destroyed beforedestroyed component ,it unbind that service .Then service is destroyed .

Android ArchitectureAndroid Application

Component

A content provider manages a sharedset of application data. We can storethe data in the file system, an SQLitedatabase, on the web or somewhereelse .But through the contentprovider, other applications canquery or even modify the data.

Using Content Provider :

1.Contact Contact details2.Browser Browser Bookmarks, history3.SdCard Media files such as audio, video andimage

Android ArchitectureAndroid Application

Component

A broadcast receiver is a component thatdoes nothing but receive and react tobroadcast announcements.

For Example, announcements that thetimezone has changed, that the battery islow, that a picture has been taken, internetconnected .

Android ArchitectureAndroid Application

Component

Declare With Manifest :

<applicationandroid:label="@string/app_name" android:icon="@drawable/icon"><receiverandroid:name="NetworkReceiver"> <intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"/> </intent-filter></receiver></application>

Android ArchitectureAndroid Application

Important Part :Manifest File

The Manifest is a structured XML file and is alwaysnamed AndroidManifest.xml for all applications.

it describes the components of the application likeits activities, services, broadcast receivers .

It determines which processes will host applicationcomponents, and it also declares the permission ofthe application .

Android ArchitectureAndroid Application

Important Part :Manifest File

Android ArchitectureAndroid Application

Important Part :Manifest File

Three of the core component of an application

–Activity , Services and Broadcast Receivers –

are activated through massages called Intent .For

example an Activity can send an Intents to the

Android system which starts another Activity.

The destination is explicitly defined in Intents.

Android ArchitectureAndroid Application

Important Part :Manifest File

An Intent Filter define to application system which intents they can handle. An activities, services, and broadcast receivers can have one or more intent filters. Each intent filter describes a capability of the component.

It declare in manifest file of application .

Android ArchitectureAndroid Application

Important Part :Manifest File

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"package="de.vogella.android.intent.explicit" android:versionCode="1"android:versionName="1.0" > <uses-sdk android:minSdkVersion="15" /> <application android:icon="@drawable/icon" android:label="@string/app_name" ><activity android:name=".ActivityOne"android:label="@string/app_name" ><intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity><activity android:name="ActivityTwo“android:label="ActivityTwo" ></activity> </application></manifest>

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) Overview

Android ArchitectureAndroid Application

Important Part :Manifest File

NFC Near Field Communication is one of the

latest wireless communication technologies.

As a short-range wireless connectivity

technology, NFC offers safe— yet simple and

intuitive — communication between electronic

devices. Users of NFC-enabled devices can

simply point or touch their devices to other

NFC-enabled elements in the environment to

communicate with them, making application

and data usage easy and convenient.

Near Field Communication (NFC) Overview

Android ArchitectureAndroid Application

Important Part :Manifest File

NFC (Near Field Communication) Communication technology based on radio waves at

13.56 MHz frequency

Short range (<= 10 cm theoretical, 1-4 cm typical)

Low speed (106 / 216 / 414 kbps)

Low friction setup (no discovery, no pairing)

• Setup-time < 0.1 Sec

Communication roles:

• Master Device: NFC Initiator (starts communication,

typically a device)

• Slave Device: NFC Target (passive tag or device)

NFC Forum (founded 2004 by NXP, Sony, Nokia)

• Popularization of NFC

Today: More than 150 members

Near Field Communication (NFC) Overview

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) Overview

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) Overview

Android and NFC

Android Gingerbread Tag reading (2.3.2) Tag writing (2.3.3) Limited P2P (NDEF push only, 2.3.3) Android NFC Devices Nexus S contains PN544 NFC Controller from NXP + SecureMX–Embedded Secure Element –Support of SE on SIM Samsung Galaxy S2 –SWP (no embedded SE)

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) Overview

How NFC

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) Overview

NFC and Others ?

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) Overview

NFC Future :

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPS

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPS

Android provides us with a library known as Google Maps Library, using which we can create a map viewing acivity of our own.

It is completed in two steps:-• Generate MD5 fingerprint• Generate unique API key

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPS

We need the "debug.keystore" file that can be found at the following path

"C:\Documents and Settings\rahul.tripathi\.android“

Open command Prompt and go to the Java installed directory. ("C:\Program Files\Java\<JDK1.6>\bin")

Then type the below line (given in box) and press enter.

keytool.exe -list -alias androiddebugkey -keystore " C:\Documents and Settings\rahul.tripathi\.android " -storepass android -keypass android

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPS

It is necessary to login in google account to generate the API key.

Then follow this link : http://code.google.com/android/maps-api-signup.html

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPS

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) Overview

Known As Global Positioning System The Global Positioning System (GPS) is a

space-based satellite navigation system that provides location information anywhere on the Earth.

G.P.S. is freely accessible to anyone with a GPS receiver.

Only devices which are GPS hardware enable can receive the signal and show the position.

Google map and GPS

Android ArchitectureAndroid Application

Important Part :Manifest File

Knowing where the user is, allows our application to be smarter and deliver better information to the user.

When developing a location-aware application for Android, we can utilize GPS.

To use Gps in android we need a reference to the system Location Manager. And a listener that responds to location updates.

On location changed() method gives the position when device position changes.

Near Field Communication (NFC) OverviewGoogle map and GPS

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPS

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Pull :Most of useful applications on your mobile phone use the internet to keep users connected .Traditionally many apps use pulling to fetch data periodically .

Example :Connect to the server every 15 minute . Some time it get data some times not .it create unnecessary stress on the server and network .Polling is especially problematic for mobile device because it consume s Precious network bandwidth and battery life .

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Push Notification :

• After android 2.2 is possible to push notification to an Android app. This service is called "Cloud to Device messaging" or short C2DM.

• In the iOS world it is knows as “push notifications”

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Android Cloud to Device Messaging (C2DM) was launched in 2010. it is a service that helps developers send data from servers to their applications on Android devices. The service provides a simple, lightweight mechanism that servers can use to tell mobile applications to contact the server directly, to fetch updated application or user data. The C2DM service handles all aspects of queuing of messages and delivery to the target application running on the target device.

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

It allows third-party application.

C2DM makes no guarantees about delivery or the order of messages.

An application on an Android device doesn’t need to be running to receive messages.

It does not provide any built-in user interface or other handling for message data.

It requires devices running Android 2.2 or higher that also have the Market application installed.

It uses an existing connection for Google services.

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

How C2DM works :

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Lifecycle Flow Here are the primary processes involved in cloud-to-device messaging:Enabling C2DM An Android application running on a mobile device registers to receive messages.Sending a message A third-party application server sends messages to the device.Receiving a message An Android application receives a message from a C2DM server.

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Limitations

C2DM imposes the following limitations:

The message size limit is 1024 bytes.

Google limits the number of messages a sender sends in aggregate, and the number of messages a sender sends to a specific device.

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Goodbye C2DM ! Welcome GCM !

GCM is the next generation of C2DM

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Google Cloud Massaging (GCM)

Google Cloud Massaging (GCM) replaces the beta version of Android cloud to device messaging (C2DM).

Google Cloud Messaging for Android (GCM) is a service that helps developers send data from servers to their Android applications on Android devices.

This could be a lightweight message telling the Android application that there is new data to be fetched from the server (for instance, a movie uploaded by a friend), or it could be a message containing up to 4kb of payload data (so apps like instant messaging can consume the message directly).

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Google Cloud Massaging (GCM)

GCM uses an existing connection for Google services. For pre-3.0 devices, this requires users to set up their Google account on their mobile devices.

A Google account is not a requirement on devices running Android 4.0.4 or higher.

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

GCM replaces C2DM. The focus of GCM is as follows:

• Ease of use. No sign-up forms.• No quotas.• GCM and C2DM stats are available

through the Android Developer Console.

• Battery efficiency.• Rich set of new APIs.

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Difference Between C2DM and GCMGCM builds on the core foundation of C2DM. Here is what's different:• Simple API Key• Sender ID• JSON format• Multicast messages• Multiple senders• Time-to-live messages• Messages with payload• Canonical registration ID

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

If you call mostly out of India then you purchase calling card from the market . Scratch off Card and get Number mostly given on the back of the card .This is the gateway or the Toll Free number that you need to dial to make an international call. Using Country region pin (Like India +91) with Number of friend which you want to Call but if you have lot of call out of India then Its very irritating to us to keep card and save this with different different International number .My C Calling Card Application make help to its user MyCprovide service to save there calling card Data and use that saved calling card with any of international number which is saved in our mobile . It gives option when we want to make a international call can choose any one of saved calling card .

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Important Keyword of Apps :

Title of the card : Its easy to name your cards by either the brand of card you use, or the card you use to dial a particular country.For example, Japanese Card for all your Japan contacts.Number : This is the gateway or the Toll Free number that you need to dial to make an international call. Its mostly given on the back of the card. Pin Code : Pin Code is Country region Code .It printed with card .EX. Card title = Jpn

Country Code Number = 23435336Card Pin Code = 85

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way

Android ArchitectureAndroid Application

Important Part :Manifest File Near Field Communication

(NFC) OverviewGoogle map and GPSC2DM

Android Push notification

Current Project

MyC-Calling on the Way