У меня есть приложение, и я хотел бы отправить уведомление в определенное время каждый день. это мой код:Отправить уведомление в android
AlarmManager am = (AlarmManager)getBaseContext().getSystemService(alarm);
Intent intent = new Intent("WAKE_UP");
PendingIntent sender = PendingIntent.getBroadcast(getBaseContext(), 0, intent, 0);
time use AlarmManager.set().
am.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis() , AlarmManager.INTERVAL_DAY, sender);
// Prepare intent which is triggered if the
// notification is selected
Intent intent2 = new Intent(this, NotificationReceiverActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent2, 0);
// Build notification
// Actions are just fake
Notification noti = new Builder(this)
.setContentTitle(" boghche " + "shake")
.setContentText("Shake kon :/").setSmallIcon(R.drawable.icon)
.setContentIntent(pIntent)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// hide the notification after its selected
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, noti);
Но я не могу отправить его в определенное время.
http://stackoverflow.com/questions/23440251/how-to-repeat-notification-daily-on-specific-time-in-android -through-background/23440985 # 23440985 –
Что такое уровень API? – Skynet