Welcome to Headwind MDM Q&A, where you can ask questions and receive answers from other members of the community.

Please do not post bug reports, missing feature requests, or demo inquiries. If you have such an inquiry, submit a contact form.

0 votes
When using push messages to start a specific activity within an app,
{pkg: "my.app", action: "my.app.SecondActivity"}
does start the application, but not "SecondActivity".

android:exported is set to true.
What am I missing?
by (210 points)

1 Answer

0 votes
The "action" attribute contains the Action, not the Activity. Your activity should declare in AndroidManifest.xml that it handles a specific Action. See more details here: https://developer.android.com/guide/components/intents-filters
by (37.6k points)
Thank you for your response.

Declaring this in AndroidManifest.xml:
        <activity
            android:name="my.test.project.activity"
            android:exported="true">
            <intent-filter>
                <action android:name="my.test.project.DOACTION" />
            </intent-filter>
        </activity>

And sending a push message of type runApp with this payload:
{"pkg": "my.test.project", "action": "my.test.project.DOACTION"}

It still only starts the App, not the declared action.
Perhaps you need to add a category as suggested here: https://stackoverflow.com/questions/10921451/start-activity-using-custom-action  Also, consider reviewing Headwind MDM launcher code in app/src/main/java/com/hmdm/launcher/worker/PushNotificationProcessor.java#runApplication(), perhaps there's a bug.
Adding
<category android:name="android.intent.category.DEFAULT" />
sadly doesn't fix it.
It must be <category android:name="android.intent.category.LAUNCHER" />
to work.
...