Skip to main content

One post tagged with "debug"

View All Tags

· 3 min read

Motivation

You may want to observe/ debug behaviour related to your app's Activity, Broadcast Receiver or Service being launched by an Intent, without any side effects of the application already running. For example, I was testing push notifications, and wanted to debug the case where no other application components was running (Activity, Service), and only the Broadcast Receiver declared in my AndroidManifest.xml was launched in response to the push notification message. This is only possible if the application hasn't been launched yet by Android Studio.

The trick is prevent your app from launching until the debugger is attached, and then to attach the debugger. This means you won't miss anything between the app launching and you attaching the debugger.