how to make Android Application restart automatically on phone restart. i made an app for android and now i want that it will restart automatically when phone is restarted ,can anyone please help me over this.?
Asked
Active
Viewed 307 times
1
-
You can check out the question and answer in this [post](http://stackoverflow.com/questions/6391902/how-to-start-an-application-on-startup) – DroidBender Aug 22 '12 at 11:32
3 Answers
0
You can use a BroadcastReceiver to listen for BOOT_COMPLETED broadcast and do what you want.

Mus
- 1,860
- 2
- 16
- 19
0
<receiver android:name=".BootReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

Kanaiya Katarmal
- 5,974
- 4
- 30
- 56
-
can you please explain it a litte more that where to use this boot reciever in .java file – user1616773 Aug 22 '12 at 11:38
-
create BootReceiver.java file this file run automatic when BOOT_COMPLETED. and in this file you can right restart code – Kanaiya Katarmal Aug 22 '12 at 11:54
0
From http://www.anddev.org/launch_activity_on_system-emulator_startup-t428.html
In manifest
<receiver class=".MyStartupIntentReceiver">
<intent-filter>
<action android:value="android.intent.action.BOOT_COMPLETED" />
<category android:value="android.intent.category.HOME" />
</intent-filter>
</receiver>
MyStartupIntentReceiver-Class:
public class MyStartupIntentReceiver extends IntentReceiver {
@Override
public void onReceiveIntent(Context context, Intent intent) {
/* Create intent which will finally start the Main-Activity. */
Intent myStarterIntent = new Intent(context, LaunchOnStartup.class);
/* Set the Launch-Flag to the Intent. */
myStarterIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
/* Send the Intent to the OS. */
context.startActivity(myStarterIntent);
}
}

Sunny Kumar Aditya
- 2,806
- 4
- 26
- 38