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

Android Question Recognize Third Party App Open

Discussion in 'Android Questions' started by canalrun, Apr 20, 2019.

  1. canalrun

    canalrun Well-Known Member Licensed User

    Is there a way to recognize when a third-party app opens on screen?

    I would like to recognize on Android when Skype has an incoming call. Skype will pop up a full page screen announcing the incoming call.

    If the call is missed Skype posts a notification of the missed call. I use Erel's NotificationListener to detect this missed call notification and I flash some Wi-Fi connected light bulbs. The problem is this is a "missed call notification", so the other party has already hung up. Skype currently does not have an "incoming call notification".

    I would hope that there is something like the NotificationListener that I could use to detect when Skype opens the page announcing an incoming call. I would then use this to flash the light bulbs.

    Is it possible to detect a third-party app opening? Can anyone point me in the right direction?

    Thanks,
    Barry.
     
  2. Brandsum

    Brandsum Active Member Licensed User

  3. OliverA

    OliverA Expert Licensed User

    Please note that the above linked solution has been deprecated since Lollipop (API 21)
     
  4. moster67

    moster67 Expert Licensed User

    You can use my accessibility services library. If I recall correctly I exposed a method or event to get the current activity
     
  5. canalrun

    canalrun Well-Known Member Licensed User

    Thanks. Polling for the currently running activity is definitely a possibility. Polling every 15 seconds or so 24 hours a day doesn't sound nice, but it's on an older phone (API 23), the phone is dedicated to this one task, and it's constantly plugged in to the charger – so I guess the usual warnings about polling don't matter.

    I will have to play around and see if the Skype screen that pops up has a unique activity name. Skype pulls all sorts of tricks so it may be the same activity as the normal Skype calling page just showing a different view.

    Barry.
     
  6. moster67

    moster67 Expert Licensed User

    Should still be possible to determine using Accessibility Service. If you are actually interested in one specific app, just like the WhatsApp sample I posted, you can monitor a specific package-name only. It is a bit cumbersome to set up but once done, it works fine....

    https://www.b4x.com/android/forum/t...users-with-disabilities-automation-etc.95216/
     
    DonManfred 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