Saturday, July 30, 2011

A service is an application component that can run some long running task in the background without the need for a user interface. Some other application component can start the service and this service will then keep on running even if the user switches to another application.

A service can essentially take two forms:

Unbounded
A service is "started" when an application component (such as an activity) starts it by calling startService(). Once started, a service can run in the background indefinitely (unbounded), even if the component that started it is destroyed. Usually, a started service performs a single operation and does not return a result to the caller. For example, it might download or upload a file over the network. When the operation is done, the service should stop itself.

Bound
A service is "bound" when an application component binds to it by calling bindService(). A bound service offers a client-server interface that allows components to interact with the service, send requests, get results, and even do so across processes with interprocess communication (IPC). A bound service runs only as long as another application component is bound to it. Multiple components can bind to the service at once, but when all of them unbind, the service is destroyed.

As you can see in diagram there some method in
Unbounded service class for life cycle :

startService(Intent Service)
This you must call to start un-bounded serviec

onCreate()
This method is Called when the service is first created

onStartCommand(Intent intent, int flags, int startId)
This method is called when service is started

onBind(Intent intent)
This method you must call if you want to bind with activity

onUnbind(Intent intent)
This method is Called when the service will un-binded from activity

onRebind(Intent intent)
This method is called when you want to Re-bind service after calling un-bind method

onDestroy()
This method is called when The service is no longer used and is being destroyed

Thursday, July 28, 2011

I’m just starting with Android App Development, and if you are a beginner like me, you probably want to understand two of main concepts of Android: Activities and Intents.
After Hello World Example i wanted to know Activity Life-cycle so i learn this and sharing with you..
This is the Android Activity Life Cycle Diagram described by Google

As you can see in diagram there 7 method in activity base class for life cycle :onCreate(Bundle savedInstanceState)
This method is Called when the activity is first created.

onStart()
This method is Called when activity is becoming visible to the user.

onResume()
This method is Called when the activity will start interacting with the user.

onPause()
This method is Called when the system is about to start resuming a previous activity.

onStop()
This method is Called when the activity is no longer visible to the user, because another activity has been resumed and is covering this one.

onRestart()
This method is Called after your activity has been stopped, prior to it being started again.

onDestroy()
This method is The final call you receive before your activity is destroyed.

Other Methods:onSaveInstanceState(Bundle outState)
This method is called before an activity may be killed so that when
it comes back some time in the future it can restore its state.

onRestoreInstanceState(Bundle savedInstanceState)
This method is called after onStart() when the activity is being
re-initialised from a previously saved state.
The default implementation of this method performs a restore of any
view state that had previously been frozen by onSaveInstanceState(Bundle).

Create a simple android app with default activity "MyActivity" then put the code like this

Monday, July 25, 2011

Android is an operating systembased on Linux with a Java programming interface for mobile devices such as smartphones and tablet computers. It is developed by the Open Handset Alliance led by Google.

Who founded Android, Inc?
Andrew E. Rubin (key person) at Open Handset Alliance.

Android, Inc. was founded in Palo Alto, California, United States in October, 2003 by Andrew E. Rubin (co-founder of Danger), Rich Miner (co-founder of Wildfire Communications, Inc.), Nick Sears (once VP at T-Mobile),and Chris White (headed design and interface development at WebTV) at Open Handset Alliance.Google Purchased the AndroidGoogle purchased the initial developer of the Android software, Android Inc., in 2005, making Android Inc. a wholly-owned subsidiary of Google Inc. Key employees of Android Inc., including Andy Rubin, Rich Miner and Chris White, stayed at the company after the acquisition.

drivers for hardware, networking, file system access and inter-process-communication

Android Application Components
There are four different types of application components. Each type serves a distinct purpose and has a distinct lifecycle that defines how the component is created and destroyed.

Activities
An activity represents a single screen with a user interface. For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails.
An activity is implemented as a subclass of Activity.

ServicesA service is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface. For example, a service might play music in the background while the user is in a different application. Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it.

A service is implemented as a subclass of Service.

Content providers
A content provider manages a shared set of application data. You can store the data in the file system, an SQLite database, on the web, or any other persistent storage location your application can access. Through the content provider, other applications can query or even modify the data (if the content provider allows it). For example, the Android system provides a content provider that manages the user's contact information.

A content provider is implemented as a subclass of ContentProvider.

Broadcast receivers
A broadcast receiver is a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low,message has been received or a picture was captured.

A broadcast receiver is implemented as a subclass of BroadcastReceiver.

Android Version historyAndroid Beta
The Android beta was released on November 5, 2007, while the software developer's kit (SDK) was released on November 12, 2007.

Android 1.0
Android 1.0, the first commercial version of the software, was released on September 23, 2008. The first Android device, the HTC Dream,which was following Android 1.0 features.

Android 1.1
On February 9, 2009, the Android 1.1 update was released, initially for the T-Mobile G1 only. The update resolved bugs, changed the API and added a number of other features.

Android 3.x (Honeycomb)
On February 22, 2011, the Android 3.0 (Honeycomb) SDK – the first tablet-only Android update – was released, based on Linux kernel 2.6.36.The first device featuring this version, the Motorola Xoom tablet, was released on February 24, 2011.

Android 4.1 (Jelly Bean)
Google announced the next Android version on June 27, 2012, 4.1 Jelly Bean. Jelly Bean is an incremental update, with the primary aim of improving the user interface, both in terms of functionality and performance.

About Me

Typical "Desi Jatt", Presently Helping Recoh Innovation for Research and Development in their iPhone & Android Apps.
In Personal life, I Write lyrics, compose and Sing while playing My Guitar, Harmonica, Piano, Keyboard, Harmonium..I do enjoy every moment of my life, Here for sharing knowledge what I learn every day..Cheers!!