Reputation: 309
Is there any way to capture/intercept Intents of application during runtime without modifying Android framework? Modifying Android framework might require too much work. Please help me.
Upvotes: 28
Views: 27272
Reputation: 95
Inside instrumentation tests (tried on UI Automator) you can use IntentMonitor:
val intentMonitor = IntentMonitorRegistry.getInstance()
intentMonitor.addIntentCallback { intent ->
// your code here
}
Upvotes: 1
Reputation: 13367
To view Intents as they happen, run logcat in a shell and filter it down to just the Intents like this:
adb logcat | fgrep -i intent
(You can also add a filter for just your app's Intents, but that would exclude Intents sent to your app by the system and by other apps.)
This should show Intents such as
I/ActivityManager( 585): Starting activity: Intent { action=android.intent.action...}
To see system-wide Intents, try the Intent Intercept app.
To see all Intents sent to your own classes, then
For info on all the standard Intent actions, see Intent.
Upvotes: 49