Java 应用程序关闭时未显示通知--Android API 29

Java 应用程序关闭时未显示通知--Android API 29,java,android,android-notifications,Java,Android,Android Notifications,是否可能在应用程序关闭时弹出通知 这是我当前的代码,它只在应用程序打开或处于应用程序的后台时工作 Intent intent = new Intent(this, AlarmReceiver.class); intent.putExtra("NotificationText", "some text"); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, ledgerId, intent, PendingIntent.F

是否可能在应用程序关闭时弹出通知

这是我当前的代码,它只在应用程序打开或处于应用程序的后台时工作

Intent intent = new Intent(this, AlarmReceiver.class);
intent.putExtra("NotificationText", "some text");
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, ledgerId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, 'X seconds in milliseconds', pendingIntent);

尝试此链接…在服务类上使用Notification manager,因为服务可以在应用关闭时继续运行请参见,并尝试此链接…在服务类上使用Notification manager,因为服务可以在应用关闭时继续运行请参见