stoefln
stoefln

Reputation: 14575

android: how to know whether app was called by another app

I managed to register my app as camera app via

<activity android:name=".CameraActivity" android:clearTaskOnLaunch="true">
    <intent-filter>
        <action android:name="android.media.action.IMAGE_CAPTURE" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

Now, I would like to know whether my app was startet as intent or directly by the user, so I can react accordingly:

Anyone knows how to get this information?

Upvotes: 0

Views: 143

Answers (2)

slyfox
slyfox

Reputation: 960

Activity.getIntent will return the Intent that initiated your activity, so you can examine the intent's action/category/etc. to determine what your activity should do.

Upvotes: 2

clemp6r
clemp6r

Reputation: 3723

Analyse the value of intent.getAction() to determine whether the activity was launched by the home/launcher, or by another application using the "IMAGE_CAPTURE" action.

Upvotes: 2

Related Questions