我的 Android 应用会创建一个通知。通知已正确显示。但是,TalkBack 不会宣布通知,例如,当我收到新电子邮件时。如果我显示所有通知并滚动浏览它们,TalkBack 将读取我的通知文本。但是,我希望它在提出通知时自动宣布通知。
String notificationText = getResources().getString(R.string.notifyText);
String notificationTitle = getResources().getString(R.string.notifyTitle);
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(notificationTitle)
.setContentText(notificationText)
.setPriority(NotificationCompat.PRIORITY_MAX);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());