I have an application which starts a Remote Service in its first launched activity. Then, in another activity, the user can set the configuration of the application. Please
try this code,
public void onClick(DialogInterface dialog, int which) {
sauvegarde();
restart(2);
}
restart method
public void restart(int delay) {
Intent launchIntent = new Intent(context, YourStartUpActivity.class);
PendingIntent intent = PendingIntent.getActivity(getApplicationContext(), 0, launchIntent , 0);
AlarmManager manager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
manager.set(AlarmManager.RTC, System.currentTimeMillis() + delay, intent);
System.exit(2);
}