Android 8.0 알림 표시줄에 맞춤법 표시(Notification에 문제가 표시되지 않음)
3082 단어 프로젝트 문제
먼저 공식 통지 문서를 붙이다.https://developer.android.google.cn/training/notify-user/build-notification
Android O(SDK26 버전)는 공지 채널(Notification Channels)을 도입하여 다음과 같은 여러 속성을 추가했습니다.
중요도 수준: IMPORTANCENONE、IMPORTANCE_MIN、IMPORTANCE_MAX、IMPORTANCE_LOW、IMPORTANCE_HIGH(유사한 내용은 위에서 표시한 링크를 참조하여 공식적으로 모두 설명함)
그래서 API를 보고 나서야 안드로이드 8을 발견했어요.0에서 알림 표시줄의 다운로드 업데이트 표시를 다시 정의해야 합니다. 개인이 정의한 도구 클래스로 설명하려면 애플리케이션의 유일한 ID와Name
private static final int YOUR_NOTIFICATION_ID = 0x002;
private static final String YOUR_CHANNEL_ID = "YOUR_NOTIFY_ID";
private static final String YOUR_CHANNEL_NAME = "YOUR_NOTIFY_NAME";
, ID Name , , .
@RequiresApi(api = Build.VERSION_CODES.O)
public void CreateNotificationChannel(NotificationManager notificationManager) {
NotificationChannel channel = new NotificationChannel(YOUR_CHANNEL_ID,YOUR_CHANNEL_NAME,Notifi cationManager.IMPORTANCE_HIGH);
notificationManager.createNotificationChannel(channel);
}
if (Build.VERSION.SDK_INT >= 26) {
createNotificationChannel(getManager());
notification = new Notification.Builder(getApplicationContext(), YOUR_CHANNEL_ID).build();
} else {
notification = new Notification();
}
//
notification.icon = ;
notification.flags = ;
notification.tickerText = ;
notification.when = ;
notification.defaults = ;
notification.contentView = ;
}
상용 필드:contentIntent 설정 PendingIntent 대상, 클릭할 때 이 Intentdefaults를 보내서 기본 효과 flags 설정 flag 위치를 추가합니다(예를 들어 FLAGNO_CLEAR 등 icon 설정 아이콘 sound 설정 사운드tickerText 상태막대에 표시되는 텍스트
when 이 알림을 보내는 시간 스탬프
도구 클래스 NotificationUtils에 선언된 내용:
private NotificationManager manager;
2. 알림 표시줄 다운로드 업데이트 완료 후 설치에 대해서도 주의해야 한다.
8.0 여부를 판단하려면 '알 수 없는 출처 허용' 을 검사해야 합니다
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
springboot 크로스 도 메 인 CORS 문제 해결,같은 프로 토 콜,같은 도 메 인 이름,같은 포트 는 같은 도 메 인 이 라 고 불 립 니 다.브 라 우 저 는 도 메 인 간 요청 을 허용 하지 않 습 니 다(localhost:이 컴퓨터 127.0.0.0.1:이...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.