버튼을 누르면 내 알림 팝업이 나타 났지만 버튼을 누른 후 X 분 (또는 Y 시간)이 경과 할 때까지 알림이 표시되지 않도록 추가 개발하고 싶습니다. .X 분 후에 알림을 표시하도록 설정하는 방법은 무엇입니까?
관련 코드 :
private void sendNotif() {
notification.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.avatar));
notification.setTicker("Kayla has returned");
notification.setWhen(System.currentTimeMillis());
notification.setContentTitle("Kayla has returned");
notification.setContentText("See what news she has to share");
Intent notifIntent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT);
notification.setContentIntent(pendingIntent);
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify(notifId, notification.build());
}
private void setNotif() {
Button btn = (Button) findViewById(R.id.notifBtn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendNotif();
}
});
}
내가 어떤 방법으로 알람 관리기를 사용해야합니다,하지만 난 통지에 통합 할 수없는 것 냈어요 ...
는'AlarmManager'는 의도를 발생 설정된 시간 (또는 사용 방법에 따라 달라질 수 있습니다.) 'BroadcastReceiver'를 사용하여 그 의도를 처리하고 그 의도를 알려주십시오. – Kuffs
사례를 보여줄 수 있습니까? – PQuix
https://stackoverflow.com/a/7960057/1027277 – Kuffs