jeudi 14 mai 2015

parent activity with implicit intents

I am successfully using the attribute android:parentActivityName in manifest, in order to set the parent activity (activity A) when another activity (activity B) is started by a push notification, for example. Then, if I go back, I navigate to activity A.

However, it doesn't work with implicit intents. I have an intent-filter declared in manifest for activity B. When activity B is launched from outside the app, it does not seem to effect the attribute android:parentActivityName (or meta-data android.support.PARENT_ACTIVITY with lower APIs).

How I can set the parent activity in that case?

The block of manifest:

<activity
        android:name="com.domain.app.activities.ActivityB"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateUnchanged"
        android:parentActivityName="com.domain.app.activities.ActivityA" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.domain.app.activities.ActivityA" />
        <intent-filter>
            <category android:name="android.intent.category.DEFAULT" />
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="http" android:host="domain.com" android:pathPattern=".*" />
        </intent-filter>
    </activity>

Any help is appreciated.

Thanks!

Aucun commentaire:

Enregistrer un commentaire