I am trying to get an alarm or notification to go at a certain time and date. I want to be able to have multiple alarms for specific dates in an array. I don’t know where to continue off of having my button working:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Button button = (Button)findViewById(R.id.button1);
// button.setOnClickListener(this);
final CheckBox checkBox = (CheckBox) findViewById(R.id.checkBox1);
final Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
if (checkBox.isChecked()) {
}
}
Thank you in advance for helping me.
You’re going to want to use the Alarm Manager
This tutorial is a pretty simple example how to use it.
Another simple exmaple that breaks it down into the basic steps of
EDIT
To make a notification, modify the broadcast receiver to create a notification when the alarm event is received.
Android Status Notification Documentation shows pretty well the basic steps to create a notification.
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) receiverContext.getSystemService(ns);
EDIT 2
Creating notification at specified time using Alarm Manager