Android Nougat(API级别24)和Android 10(API级别29)之间有一些通知和闹钟的Android SDK更改。以下是解决方法和代码示例:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    // 创建通知渠道
    String channelId = "my_channel_id";
    CharSequence channelName = "My Channel";
    int importance = NotificationManager.IMPORTANCE_DEFAULT;
    NotificationChannel channel = new NotificationChannel(channelId, channelName, importance);
    // 设置其他通知渠道属性
    // ...
    // 注册通知渠道
    NotificationManager notificationManager = getSystemService(NotificationManager.class);
    notificationManager.createNotificationChannel(channel);
    // 发送通知
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this, channelId)
            .setSmallIcon(R.drawable.notification_icon)
            .setContentTitle("My Notification")
            .setContentText("Hello World!")
            .setPriority(NotificationCompat.PRIORITY_DEFAULT);
    // ...
    notificationManager.notify(notificationId, builder.build());
} else {
    // 在Android Nougat及以下版本中发送通知
    // ...
}
setAndAllowWhileIdle()或setExactAndAllowWhileIdle()方法来设置闹钟。以下是示例代码:AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent alarmIntent = new Intent(this, MyAlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    // 在Android 6.0及以上版本使用setAndAllowWhileIdle()方法
    alarmManager.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 5000, pendingIntent);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    // 在Android 4.4及以上版本使用setExact()方法
    alarmManager.setExact(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 5000, pendingIntent);
} else {
    // 在Android 4.4以下版本使用set()方法
    alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 5000, pendingIntent);
}
请注意,以上代码示例仅展示了一些主要的更改。根据您的实际需求,可能还需要进行其他更改和适配。