Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

383
Views
¿Hay alguna forma de obtener el historial de notificaciones del dispositivo?

Estoy desarrollando una aplicación de estadísticas de uso y me pregunto cómo otras aplicaciones pueden acceder al historial de notificaciones de los dispositivos .

En este momento estoy trabajando con NotificationListenerService , pero esto solo puede manejar las notificaciones nuevas recibidas, no las pasadas. Revisé el DOC de Android y encontré algunos métodos que son 'solo del sistema', como getHistoricalNotifications() , o que requieren el permiso ACCESS_NOTIFICATION .

La cuestión es que hay algunas aplicaciones que realmente pueden acceder a los datos del historial de notificaciones.

Android DOC también muestra una nueva API en Android Q llamada NotificationStats pero no está disponible en este momento.

¿Algun consejo? ¿Es esto posible de una manera no hacky?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

ActionDash muestra esto ingrese la descripción de la imagen aquí

Como mencionó, getHistoricalNotifications es una API de nivel de sistema a la que solo acceden las aplicaciones del sistema, por lo que Google Digital Wellbeing, que es una aplicación del sistema, puede mostrarlas.

Así que creo que no hay forma de obtener un historial de notificaciones para aplicaciones de terceros.

 /** * System-only API for getting a list of recent (cleared, no longer shown) notifications. * * Requires ACCESS_NOTIFICATIONS which is signature|system. */ @Override public StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count) { // enforce() will ensure the calling uid has the correct permission getContext().enforceCallingOrSelfPermission( android.Manifest.permission.ACCESS_NOTIFICATIONS, "NotificationManagerService.getHistoricalNotifications"); StatusBarNotification[] tmp = null; int uid = Binder.getCallingUid(); // noteOp will check to make sure the callingPkg matches the uid if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ACCESS_NOTIFICATIONS, uid, callingPkg) == AppOpsManager.MODE_ALLOWED) { synchronized (mArchive) { tmp = mArchive.getArray(count); } } return tmp; }
over 4 years ago · Santiago Trujillo Report

0

Debe almacenar los datos de notificación de la aplicación cuando se recibe la notificación en la base de datos sql y cuando desea el historial de la notificación de la aplicación respectiva, puede obtener fácilmente todas las notificaciones al realizar una consulta en la base de datos sql.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!