0

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:

  • returning an image via setResult (in case of returning to the previous app)
  • saving the image to disk (in those cases where no previous app is involved)

Anyone knows how to get this information?

stoefln
  • 14,498
  • 18
  • 79
  • 138
  • possible duplicate http://stackoverflow.com/questions/7564461/how-to-know-if-an-activity-is-called-using-startactivityforresult-or-simply-call – Shadow Jan 07 '12 at 10:37

2 Answers2

2

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.

clemp6r
  • 3,665
  • 2
  • 26
  • 31
2

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.

slyfox
  • 950
  • 9
  • 22