Search code examples
androidandroid-intentbroadcastintentfilterandroid-broadcast

Listening to Intent being sent


I'm currently working on a productivity app. One of the features includes obtaining an information about apps that are started by the user

For example I would like to obtain information that the user has started the Youtube app or listen for a specific Intent being sent without registrating a BroadcastReceiver

Is this even possible?


Solution

  • You cannot intercept intents sent to other apps by extending the BroadcastReceiver abstract class for obvious security reasons. So, basically, this is not allowed using conventional features (or APIs) of the Android SDK. There might be some hacks out there that could work, but they're all hacks at the end of the day which are not guaranteed to work, for example there are some articles proposing to read the system's log, it used to work in older api levels but not anymore...see some references below and make sure you read the comments as well...

    Android, Detect when other apps are launched

    Detect when user launches a new application on an Android device

    In simple words, you can't do that. Note, that having root is a complete different story