-3
사용자가 알림을받지 않는 한 알림은 사용자에게 5 분마다 전송되므로 알림을 반복하고 싶습니다. 그리고 그가 그럴 때 경보를 취소하고 싶습니다. 알림을 5 분마다 보내는 방법은 무엇입니까?
이
내 코드,하지만 난 알람 매니저와 달력과 함께 할 무엇 확실하지 않다 :acceptBtnPendingIntent = PendingIntent.getBroadcast(this, 123, acceptBtnIntent, 0);
remoteView = new RemoteViews(this.getPackageName(), R.layout.notification_layout);
remoteView.setOnClickPendingIntent(R.id.acceptCallBtn, acceptBtnPendingIntent);
remoteView.setImageViewResource(R.id.notificationIcon, R.drawable.notification_icon);
remoteView.setTextViewText(R.id.fromTxt, fromId);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),1000 * 60 * 20, acceptBtnPendingIntent);
mBuilder = new NotificationCompat.Builder(this);
mBuilder.setSmallIcon(R.mipmap.ic_launcher)
.setCustomHeadsUpContentView(remoteView)
.setDefaults(Notification.DEFAULT_ALL)
.setContentIntent(acceptBtnPendingIntent)
.setAutoCancel(true)
.setPriority(NotificationManager.IMPORTANCE_HIGH);
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(notificationsId, mBuilder.build());
작업 스케줄러를 사용하십시오. https://medium.com/google-developers/scheduling-jobs-like-a-pro-with-jobscheduler-286ef8510129 – DroiDev
SO는 코드 작성 서비스가 아닙니다. 지금까지 시도한 방법을 제시해야합니다. – JaredH