39
Outline Introduction What is Android? Android: How it came to be Android Features Android Architecture Anatomy of an Android Application Hello Android Life Cycle of an Android Application Future of Android

Design and implementation of music player on android

Embed Size (px)

DESCRIPTION

Design and implementation of music player on android

Citation preview

Page 1: Design and implementation of music player on android

Outline

Introduction − What is Android? − Android: How it came to be − Android Features

Android Architecture Anatomy of an Android Application Hello Android Life Cycle of an Android Application Future of Android

Page 2: Design and implementation of music player on android

DESIGN and implementation of a music player based on Android in this paper. According to the feature of mobile

phone, the music player makes full use of screen to show more information. In addition to the basic functions of

playback, the music player can also make music rating and display the previous and next music name of current

music. The design of the player also has some significance for developing other applications on Android.

ABSTRACT

Page 3: Design and implementation of music player on android

What is Android?

ANDROID

Open, free software platform for mobile devices with a complete software stack

Operating system Middleware Key mobile applications

Based on Linux operating system Made available as open source via the Apache v2 license

Page 4: Design and implementation of music player on android

Open Android is...

Allows access to core mobile device functionality through standard API calls − Example

Application can call core functionality such as making calls, sending text messages, using camera...

Developers can create richer and more cohesive experiences for users

Since it's open source, it can be liberally extended as new technologies emerge

Page 5: Design and implementation of music player on android

All Applications are Equal In Android...

Android does not differentiate between the phone's basic and third party applications − All applications have equal access to the phone's capabilities − Example:

The dialer and home screen can be replaced

Page 6: Design and implementation of music player on android

Breaking down boundaries Android is...

Information from the web can be combined with data on the phone − Example:

Contacts, calendar or geographic location

Page 7: Design and implementation of music player on android

Fast and Easy Development Android allows...

SDK (Software development kit) includes − True device emulator and advanced debugging

tools − Useful libraries and tools

Example − Obtain location of the device − Allow devices to communicate with one another

Page 8: Design and implementation of music player on android

Android Features 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

(hardware acceleration optional)

Page 9: Design and implementation of music player on android

Android Features SQLite

− For structured data storage

Media support for common audio, video, and still image formats

− MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF

GSM Telephony (hardware dependent)

Bluetooth, EDGE, 3G, and WiFi (hardware dependent)

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

Page 10: Design and implementation of music player on android

Android Features

Rich development environment which includes

− device emulator − tools for debugging − memory and performance profiling − a plugin for the Eclipse IDE

Page 11: Design and implementation of music player on android

Android Architecture

Major components of the Android OS

Page 12: Design and implementation of music player on android

Android Runtime Android Architecture

Main Component: Dalvik Virtual Machine − Optimized for running in an embedded environment (limited

memory, CPU,battery) − Runs .dex files (bytecodes)

.class .jar files

Converted at build

time Optimized! More efficient!

Page 13: Design and implementation of music player on android

Android Runtime Android Architecture

Core Library − Contains all the collection classes, utilities,

IO, etc.

Page 14: Design and implementation of music player on android

Applications Android Architecture

Core Applications − Email client − SMS program − Calendar − Maps − Browser − Contacts − etc

All applications are written using the

Java Programming Language

Page 15: Design and implementation of music player on android

Anatomy of an Android Application

Application Building Blocks Activity Intent Receiver Service Content Provider

Page 16: Design and implementation of music player on android

Activity Anatomy of an Android Application

Activity UI typically corresponding to one screen Move through screens by starting other activities Example

Email application has 3 major activity

List your mail Chosen individual mail message Compose screen

Page 17: Design and implementation of music player on android
Page 18: Design and implementation of music player on android

Intent Receiver Anatomy of an Android Application

Intent Receiver Responds to notifications or status changes Can wake up your process Doesn't run unless triggered by an external event Example

Only run an application when connected to the network

Page 19: Design and implementation of music player on android

Service Anatomy of an Android Application

Service Faceless task that runs in the background Example

Music player Keeps playing even though you are navigating to other parts

Page 20: Design and implementation of music player on android

Content Provider Anatomy of an Android Application

Content Provider

Enables applications to share data Example

Any application can access the contacts database

Page 21: Design and implementation of music player on android

21

Hello Android A Peek at an Android App

Page 22: Design and implementation of music player on android

22

Hello Android A Peek at an Android App

Page 23: Design and implementation of music player on android

Application Lifecycle

Every application runs its own process − Benefits: security, protected memory, applications using CPU

intensively won't block other activities

Processes are started and stopped as needed to run an application's components

Processes may be killed to reclaim resources

It's my problem to launch/ kill processes, manage

resources, saving states, etc.

Page 24: Design and implementation of music player on android

Interesting APIs

Page 25: Design and implementation of music player on android

Java Code +

XML and Other Resources

+ Manifest File

= Android App

Page 26: Design and implementation of music player on android

IMPLEMENTATION OF MUSIC PLAYER A. SOFTWARE ARCHITECTURE The music player adopted front-back end architecture. The front-end consists of player interface and music list and was achieved by activity for interacting with user. The back-end is the implementation of playback which based on service. The communications between front-end and back-end are via intent.

Page 27: Design and implementation of music player on android

ARCHITECTURE OF MUSIC PLAYER

PLAYER INTERFACE (ACTIVITY)

back end

PLAYBACK (SERVICE)

MUSIC LIST (ACTIVITY)

FRONT END

BACK END

Page 28: Design and implementation of music player on android

SOFTWARE MODULES

The music player consists of some modules which are tab, player interface, playback, music list, list, file, mp3 information, constant value and settings.

Page 29: Design and implementation of music player on android

TAB

PLAYER INTERFACE PLAYBACK MUSIC

LIST

LIST

FILE

Mp3 information

CONSTANT VALUE SETTINGS

BLOCK DIAGRAM OF MUSIC PLAYER

Page 30: Design and implementation of music player on android

1.TAB MODULE

The tab module is the first module the player runs when the player is opened, which is used to build two tabs which are player and music list. The player associated with player interface and the music list associated with music list, which not only make full use of screen of mobile phone, but also switch between player interface and music list easily.

Page 31: Design and implementation of music player on android

2.PLAYER INTERFACE MODULE

The player interface module provides the player interface for user, and the control operations and display information of player are via it. The player interface consists of current music name, status, current/total time, progress bar, previous, play, pause, stop, next, play mode, music rating, previous and next music name.

Page 32: Design and implementation of music player on android

3.MUSIC LIST MODULE

The music list module is used to build music list by

invoking list module. The music list is clickable, and the

music will play when you click the music name in the list.

The information of the music you clicked is encapsulated

in intent and sent to playback module to play the music.

Page 33: Design and implementation of music player on android

4.PLAYBACK MODULE

The playback module is used to achieve playback and related operations, such as play, pause, stop, display the current, previous and next music name and update the progress bar. The playback module is the core module which based on service. In this module, we achieved that how to translate commands which come from the player interface module and music list module into operations and the information which is encapsulated in intent is sent through broadcast. The playback module invokes the constant value module to match the commands, and invokes the settings module to get and save the settings information.

Page 34: Design and implementation of music player on android

THE WORKFLOW OF MUSIC RATING

MUSIC RATING CHANGED

CLICK BY USER

GET THE CURRENT MUSIC NAME

Save the music name and the related music

rating value

DISPLAY THE MUSIC RATING VALUE

END

Page 35: Design and implementation of music player on android

START

Create the thread of updating time

Define and initialize variable

Player is stop

Get the current time and total

time

Translate the time

Encapsulate time into intent

Send intent via broadcast

WORKFLOW OF UPDATING TIME

Page 36: Design and implementation of music player on android

5) CONSTANT VALUE MODULE The constant value module holds a variety of constants defined by ourselves, which represent the various commands and are used to send and receive the commands.

6) SETTINGS MODULE Settings module is used to save and get a variety of setting values by using Shared Preferences . Shared Preferences, which provided by Android, is a mechanism for data access, and data store in the XML file as key-value pairs.

Page 37: Design and implementation of music player on android

7) LIST MODULE The list module encapsulates the Simple Adapter class, and that could be directly invoked by music list module to build music list. 8) FILE MODULE The file module searches the music files in the SD card and saves the information which can be used to build the music list. 9) MP3 INFORMATION MODULE The MP3 information module provides some operations about attributes of Mp3.

Page 38: Design and implementation of music player on android

Android is a multi-process system, in which each application (and parts of the system) runs in its own process. The ability for anyone to customize the Google Android platform The consumer will benefit from having a wide range of mobile applications to choose from since the monopoly will be broken by Google Android Men will be able to customize a mobile phones using Google Android platform like never before

CONCLUSION

Page 39: Design and implementation of music player on android