I am looking to know how the actual alarm app popup the dialog box on exact time without any activity in background of it. If you could please see my this post for the exact solution i am looking for but answer to this question is much appreciated.
Code for popup
public void onCreate(Bundle savedinstance)
{
super.onCreate(savedinstance);
//alarmsound = MediaPlayer.create(this, R.raw.wewillrock);
alarmsound = new MediaPlayer();
try {
if(db.getAlarmCount()!=0)
{
Cursor alarmcursor = db.getAlarmdetails(this);
if(alarmcursor!=null)
{
alarmcursor.moveToFirst();
String alarmTonepath = alarmcursor.getString(alarmcursor.getColumnIndex(GinoClockDatabase.AL_RINGTONEPATH));
alarmsound.setDataSource(alarmTonepath);
alarmsound.prepare();
}
db.close();
}
db.close();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block0
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
alarmsound.start();
((Activity)Global.context).finish();
setContentView(R.layout.reminderpopupmessage);
settingViews();
}
private void settingViews() {
yes = (Button) findViewById(R.id.btnReminderyes);
no = (Button) findViewById(R.id.btnReminderno);
}
@Override
public void onClick(View v) {
switch(v.getId())
{
case R.id.btnReminderyes:
alarmsound.stop();
Intent splashscreen = new Intent(ReminderPopupMessage.this,SplashScreen.class);
startActivity(splashscreen);
ReminderPopupMessage.this.finish();
break;
case R.id.btnReminderno:
alarmsound.stop();
ReminderPopupMessage.this.finish();
break;
}
}
I am looking more than a month for this solution but couldn't find the solution. I think i have asked more than 5 question about this alarm functionality. I hope i will get answer now.
Thanks for your help guys.