Background App Example In Android Programming

This example shows how you can minimize your activity and start a service and resume your activity whenever required.

Algorithm:

1.) Create a new project by File-> New -> Android Project name it BackgroundAppExample.
2.) Write following into main.xml:

 

 

 

3.) Write following into manifest file:

 

 

 

4.) Create and write following into src/BackgroundService.java:

 

 

 

5.) Run for output.

Steps:

1.) Create a project named BackgroundAppExample and set the information as stated in the image.

Build Target: Android 4.0
Application Name: BackgroundAppExample
Package Name: com. example. BackgroundAppExample
Activity Name: BackgroundAppExample
Min SDK Version: 8

2.) Open BackgroundAppExample.java file and write following code there:

 

 

 

3.) Compile and build the project.

Output

Leave a Comment:

4 comments
a.moeid says November 28, 2012

gud work

Reply
Frank says March 1, 2013

Hi,

this does not work for me. Could you please add this complete example as zip-archive here?

Thanks.
Frank

Reply
Anenth says March 24, 2013

Thanks for this tutorial, it was helpful 🙂

Reply
Prabhu says March 24, 2013

Thanks. It is very useful

Reply
Add Your Reply