он не работает в Android 14 и более поздних версиях, когда я устанавливаю targetSdk=34 .
Уведомление получается от службы прослушивания уведомлений путем получения уведомлений других приложений. чтобы получить уведомление от другого приложения, ниже:
Код: Выделить всё
class NotificationListenService : NotificationListenerService() {
override fun onCreate() {
super.onCreate()
}
override fun onNotificationRemoved(sbn: StatusBarNotification) {
super.onNotificationRemoved(sbn)
}
override fun onNotificationPosted(sbn: StatusBarNotification) {
super.onNotificationPosted(sbn)
notification=sbn.notification
}
}
notification.contentIntent?.send()
Подробнее здесь: https://stackoverflow.com/questions/788 ... ot-working