Try popular Android Application by Feliz-Droid

Try popular Android Application by Feliz-Droid

Speaking Caller logo
Speaking Caller
   
Battery temperature logo
Battery Temperature
   
Dual Photo logo
Dual Photo
   
Ganesh Wallpapersl ogo
Lord Ganesh Wallpaper
   
Girly Pink Keyboard l ogo
Girly Pink Keyboard

Monday, January 30, 2012

How to create auto start android application example

If you want to make your application auto start after device boot finish.
you need to see if device boot completed this is done by BroadcastReceiver let see directly steps for this.

Step 1) Create a class BootUpReceiver.



package com.android;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class BootUpReceiver extends BroadcastReceiver{


@Override
public void onReceive(Context context, Intent intent) {

   Intent i = new Intent(context, StartupActivity.class);
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(i);

}
}


Step 2) Add permissions in Manifest.



<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Step 3) Add receiver entry in Manifest.



  <receiver android:enabled="true" android:name=".BootUpReceiver"
        android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>





Complete Manifest File





<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
         <receiver android:enabled="true" android:name=".BootUpReceiver"
        android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>
     
        <activity
            android:label="@string/app_name"
            android:name=".StartupActivity" >
               </activity>
    </application>

</manifest>

Step 4) My activity which I want to show to user when my application starts.
this will be your welcome activity.



package com.android;

import android.app.Activity;
import android.os.Bundle;


public class StartupActivity extends Activity {



/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);


}
}


27 comments:

  1. how to make background process run application

    ReplyDelete
  2. i have some problem or say bug i am at emulator work perfectly but not work proper at real device so please help me

    ReplyDelete
  3. nice explanation andriod coding. very useful information for learn andriod. i want to get some more andriod tutorials. keep sharing on Andriod tutorials.
    Thank you

    ReplyDelete
  4. in my real device testing this is not working

    ReplyDelete
  5. Hi, Its not working for me

    ReplyDelete
  6. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.
    android development course fees in chennai | android app development training in chennai|Android Training institute in chennai with placement | Best Android Training in velachery

    ReplyDelete

  7. Thanks for posting useful information.You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...Really it was an awesome article...very interesting to read..
    please sharing like this information......
    Android training in chennai
    Ios training in chennai

    ReplyDelete
  8. Hai Thanks for sharing valuable info about Andriod. Now a day’s everyone is depend on andriod . This blog post is really helped a lot. Nice tutorial. Please keep sharing updated tutorials…

    ReplyDelete
  9. This information is impressive; I am inspired by your post writing style & how continuously you describe this topic.
    Android Training in Bangalore

    ReplyDelete
  10. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    Android App Development Company

    ReplyDelete
  11. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    iOS App Development Company
    iOS App Development Company

    ReplyDelete
  12. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving..
    Fitness SMS
    Fitness Text
    Salon SMS
    Salon Text
    Investor Relation SMS
    Investor Relation Text

    ReplyDelete
  13. great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
    web design Company
    web development Company
    web design Company in chennai
    web development Company in chennai
    web design Company in India
    web development Company in India

    ReplyDelete
  14. it is really amazing...thanks for sharing....provide more useful information...
    Mobile app development company

    ReplyDelete
  15. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    Texting API
    Text message marketing
    Digital Mobile Marketing
    Sms API
    Sms marketing

    ReplyDelete
  16. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Mobile Marketing Service
    Mobile Marketing Companies

    ReplyDelete
  17. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Hadoop Training in Chennai
    Big Data Training in Chennai
    Python Training in Chennai
    Python Training Centers in Chennai
    Data Science Training in Chennai
    Data Science Course in Chennai
    Data Analytics Training in Chennai
    Best AngularJS Training in Chennai
    AngularJS Training in Chennai
    QlikView Training in Chennai
    Informatica Training in Chennai

    ReplyDelete
  18. I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.
    PSD to Wordpress
    wordpress website development

    ReplyDelete
  19. Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post..Interesting post! Thanks for writing it.What's wrong with this kind of post exactly? It follows your previous guideline for post length as well as clarity.mulesoft training india

    ReplyDelete