我正在努力让我的通知显示抬头或窥视,因为它也被称为。
它适用于库存 Android 和 Lineage OS API 21-26
需要做什么才能让它在 MIUI 8 中工作?
该应用程序允许所有通知权限。
这是我的通知代码示例:
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
NotificationCompat.Builder notification = new NotificationCompat.Builder(context, "service_notifications")
.setContentTitle(name)
.setContentText("\uD83D\uDD14" + res.getText(R.string.imminent_arrival_text) + String.valueOf(Long.parseLong(eta) / 60) + res.getText(R.string.minutes_at_text) + simpleETA)
.setSmallIcon(R.drawable.ic_stat_name)
.setContentIntent(null)
.addAction(R.drawable.ic_dialog_close_light, res.getText(R.string.stop_following_label), closePendingIntent)
.setSound(Uri.parse("android.resource://" + context.getPackageName() + "/" + R.raw.quite_impressed))
.setVibrate(new long[]{1000, 1000})
.setPriority(NotificationCompat.PRIORITY_MAX)
.setCategory(NotificationCompat.CATEGORY_MESSAGE);
notificationManager.notify(
Constants.NOTIFICATION_ID.FOREGROUND_SERVICE,
notification.build());
}