poddroid
poddroid

Reputation: 855

What is the Intent action gets raised when the user starts/opens an Application in Android

What is the Intent action gets raised when the user starts/opens an Application? Basically I want to execute some code on receiving the above Intent.

Thanks, poddroid

Upvotes: 0

Views: 107

Answers (1)

LeffelMania
LeffelMania

Reputation: 12875

The Intent that triggers the first Activity of an application to run is Intent.ACTION_MAIN, with category Intent.CATEGORY_LAUNCHER.

This is why in the manifest file of any application, the Activity that will be the first screen features the intent filter:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

I don't know what code you would need to execute before your Activity's onCreate(Bundle) method, but you can also extend the Application class and override its onCreate() method to execute code before any Activity is created.

Upvotes: 2

Related Questions