1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Catch all notification 100% ....

Discussion in 'Android Questions' started by js1234, Apr 13, 2019.

  1. js1234

    js1234 Member Licensed User

    How can catch every text notification on Android? Realy I need notification of one App only at moment... But I will filter specific App...!
    Have anybody Code snippet for this example?

    p.s.
    Code can work only on higer version of Android if is harder to make on smaller versions
     
  2. DonManfred

    DonManfred Expert Licensed User

    I´n not sure it will work with higher versions of Android. Android is limiting the OS from year to year.

    But as a start
    Check NotificationListener.
     
    js1234 likes this.
  3. js1234

    js1234 Member Licensed User

    I think that this example work only if MainApp is active ... if MainApp isn't active notifications are not captured.... or?
     
  4. DonManfred

    DonManfred Expert Licensed User

    You should start a new thread for any NEW question.

    If you need to catch when not active then i guess you need to have a foreground service running. Search for "Background Location Tracking" for an example.
     
    js1234 likes this.
  5. wes58

    wes58 Active Member Licensed User

    This example works fine because you can capture and filter notifications in the notification service - so it doesn't have to be in the active MainApp. What I do, is when I detect notification from a certain app (based on the package name) I send a notification (using NB6) so I can see it on the lock screen.
    You capture the notification in Sub Listener_NotificationPosted, and you can also detect if it was cancelled by the user in Sub Listener_NotificationRemoved.
     
    js1234 likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice