Monday, August 12, 2013

4.ANATOMY OF ANDROID APPS


 ANATOMY OF ANDROID APPS


ANDROID COMPONENTS:

An Android application is  packaged in a .apk file and this file contains a collection of components.Usually components share a Linux process, by default one process per .apk file.To communicate  .apk files uses intents or AIDL.Each component has a managed life cycle. Application components are mainly 4 types and they are:

(1) Activities – A single screen with user interface to do a particular action can be considered as an activity.An application uses multiple activities that are connected to each other.
*For example: An application to sent a folder using bluetooth can have multiple activities like :welcome screen,menu,create,delete,search,share.

(2) Services – They have no visual interface but run in the  background to support the activity.Bdefault it runs in the main thread of the application that hosts it.
Example : Playing Music,Checking updates etc.

(3) Broadcast Receivers  –They receive and react to broadcast announcements.Sometimes an application wants to communicate to all other activities running in the system.In such cases they sent a system-wide Broadcast announcements.A  Broadcast receiver is a component that responds to such Broadcast announcements.
Example : In Fold and share application,the message that folder is received, is a broad cast announcement.

(4) Content Providers – They allow data exchange between applications
.Example : In fold and share application it exchange data through bluetooth ,this application can interact with other applications like file manager.This sharing of data are controlled by content providers.



This figure represents the components in detail.


BUILDING BLOCKS OF AN ANDROID APPLICATION:

Some major files that must be familiarized for Android application development are:

1) src folder: It contain .java file
2) bin folder: It contain .apk file 
3) Assests folder:  it contain text file, image file, video file etc.
Assets provide a way to include arbitrary files like  text,  xml,fonts, music, and video, in your application. 
 If you try to include these files as 'resources',  Android will process them into its resource system,  and you will not be able to get the raw data.
If you want to access data untouched,   using Assets is one way to do it.
• Android offers one more directory  where you can keep files which also will   be  included is package.  This directory called /assets.
•The difference between /res and  /assets is that, Android does not  generate IDs of assets content.
•You need to specify relative path and   name, for files inside /assets.
4) res folder: It has drawable and layout directory which contain main.xml file
5) value folder: it contain string.xml file, AndroidManifest.xml file. R.Java and Resource

a)AndroidManifest.xml

Every application must have an AndroidManifest.xml file.The manifest presents essential information about the  application to the Android system.The manifest does the following:
      1) It names the Java package for the application. The package name serves as a unique identifier for the application
     2) It describes the components of the application : The activities, services, broadcast receivers, and
      content providers.
     3)  It determines which processes will host application  components.
     4) It also declares the permissions that others are required   to have, in order to interact with the components of the   application
     5) It declares the minimum level of the Android API,   that the application requires.

b)R.java

1) The file R.java is an auto-generated file,   that is added to your application,   by the Android plug-in.
2) This file contains pointers into   the drawable, layout, and    values directories.
3) You should never  modify this file directly.  You will be only referencing R.java in most of your
   applications.

            c)Resource
                Almost all Android applications will have some sort of  resources in them; at a minimum they often have the  user interface layouts in the form of XML files.The three files that make up the default resources, are  created in the Resources folder:
  Ic_launcher.png - The default icon for the application 
  Main.xml - The default user interface layout file for the application. 
  Strings.xml – A string table to help with localization of the application

6)Widgets
• Android widgets can, bring lot of useful information directly to  your  home screen, without the need to start the application.
•Widgets should be viewed as mini applications   that sit on your home screen.
•They display various bits of information from the main  application.

a)Information widget: 
Information widgets typically display a few crucial information elements that are important to a user and track how that information changes over time.Good examples for information widgets are weather widgets, clock widgets

b)Collection widget:
As the name implies, collection widgets specialize on displaying multitude elements of the same type, such as a collection of pictures from a gallery app, a collection of articles from a news app or a collection of emails/messages from a communication app.  
 Now the world of Android is open for you with this basics we can analyze the structure of an Android application.The basic structure can give more flexibility to the users.




Note:
*Fold and share is an application developed by 2010-14 batch B.Tech computer science students of GEC Sreekrsihnapuram, as a their mini project.The members include:Deepthi.P,Likitha K.T,Gopika KV,Amritha.U.
 

2 comments: