Nicolai Weitkemper Nicolai Weitkemper - 1 year ago 118
Android Question

Android - Reacting to assist request

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">
<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" />

Answer Source

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).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download