public class NotificationActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// If this activity is the root activity of the task, the app is not running
if (isTaskRoot()) {
// Start the app before finishing
final Intent parentIntent = new Intent(this, FeaturesActivity.class);
parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
final Intent startAppIntent = new Intent(this, DfuActivity.class);
startAppIntent.putExtras(getIntent().getExtras());
startActivities(new Intent[] { parentIntent, startAppIntent });
}
// Now finish, which will drop the user in to the activity that was at the top
// of the task stack
finish();
}
}
The code above is the sample code provided by GitHub.
But I don't use what is called FeaturesActivity. So what class should I put there?
Below is my code. How would you like to modify it?
public class NotificationActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// If this activity is the root activity of the task, the app is not running
if (isTaskRoot()) {
// Start the app before finishing
final Intent intent = new Intent(this, OTA.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtras(getIntent().getExtras()); // copy all extras
startActivity(intent);
}
// Now finish, which will drop you to the activity at which you were at the top of the task stack
finish();
}
}