In my android i app i can alarm functionality and as well logout functionality. After setting my alarm time i am exiting the app by clicking the logout button.
I am using
ExitActivity.this.finish();
Intent intent1 = new Intent(ExitActivity.this,PinActivity.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent1);
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
this code to exit the app,which goes to home pin screen and after that it launches the home screen. This is because when i am coming back to my app it launches the pinscreen. Alarm working exactly what i want but while alarm popup message it has the pinactivity in the background(which i don't want). I wan't to get rid out of the pin activity in the background.
This is my receiver class?
public class ShortTimeEntryReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context,"Alarm Working", Toast.LENGTH_SHORT).show();
try {
Bundle bundle = intent.getExtras();
String message = bundle.getString("alarm_message");
Intent newIntent = new Intent(context, ReminderPopupMessage.class);
newIntent.putExtra("alarm_message", message);
newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(newIntent);
} catch (Exception e) {
Toast.makeText(context, "There was an error somewhere, but we still received an alarm", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
How do i do that? Thanks for your help guys..