I am programming a tiny app which opens the camera as it is opened via assist-request. In the onCreate method, it simply opens the camera via intent. But if the app is opened "the regular way" I'd like to display a little instruction instead of the camera.
Is there an easy solution for checking if the app was started by an assist-request?
extract from my Manifest:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
If you want to determine which sort of Intent
was used to start MainActivity
, use getIntent().getAction()
and compare it to the possible values (e.g., Intent.ACTION_MAIN
).