How can I make my application to get started while my phone boots up itself.
+3
A:
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
}
}
Ankit Jain
2010-09-01 12:55:46
Thanks a lot Guys, your input will surely find me the solution that i am trying for...Thanks a lot...
Nandagopal T
2010-09-01 13:22:04
Then mark the answer as accepted..
droidgren
2010-09-02 14:21:05
A:
i have tried applying some logic with the help of your code but got run time error,so can you please provide complete source code with an example..
thanks in advance
manjunath
2010-10-25 07:39:01