알림을 빌드 할 때 잘못된 위치를 찾을 수 없습니다.Android 헤드 Up 알림이 표시되지 않습니다.
휴대 전화가 작동 중일 때 상단에 알림을 표시하고 휴대 전화가 잠자기 상태 인 경우 잠금 화면에 을 표시하려고합니다.
여기 제가 시도한 코드입니다. 그러나 결과를 얻을 수는 없습니다. 코드가 나를 위해 잘 작동처럼
PendingIntent pendingIntent = PendingIntent.getActivity(context,0, openIntent,PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, "Normal")
.setSmallIcon(R.drawable.ic_folder)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
.setVibrate(new long[] {1000})
.setContentTitle(mainListItem.getTitle())
.setContentText(mainListItem.getDetail())
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setAutoCancel(true)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0,builder.build());
사용중인 sdk, 컴파일 및 최소 sdk 버전은 무엇입니까? –
Min sdk 14, target and compile sdk 26 – kanudo
문제는 버전 26부터 알림을 표시하기 위해 알림 채널을 만들어야합니다. 자세한 내용은 다음 링크를 확인하십시오. https://developer.android.com/guide/topics/ui/notifiers/notifications.html –