How can I make my application to get started while my phone boots up itself.
Asked
Active
Viewed 4,333 times
4
-
3Did you even try Google? http://www.androidsoftwaredeveloper.com/2009/03/20/how-to-start-on-boot/ – fredley Sep 01 '10 at 12:53
-
Duplicate of (amongst others): [How to Autostart an Android Application?](http://stackoverflow.com/questions/1056570/how-to-autostart-an-android-application) – Christopher Orr Sep 01 '10 at 15:21
1 Answers
11
You need to use a BroadcastReceiver
with android.intent.action.BOOT_COMPLETED
intent.
Add following to your manifest file:
<receiver android:name="MyApp_Receiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
MyApp_Receiver class implementing BoradcastReciever. Implement the onReceive() method and start your favorite activity from your app.
public void onReceive(Context context, Intent intent) {
// make sure you receive "BOOT_COMPLETED"
if ((intent.getAction() != null) && (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")))
{
// Start the service or activity
}
}

ankitjaininfo
- 11,961
- 7
- 52
- 75
-
Thanks a lot Guys, your input will surely find me the solution that i am trying for...Thanks a lot... – Nandagopal T Sep 01 '10 at 13:22