java - Activity Navigation with Notifications -
i'm writing android application , it's time implement notifications. 3 activities looking @ here mainactivity, messagelistactivity , messageactivity.
these go in simple > b > c format. b's parent set a, , c's parent set b. normal navigation works fine , expected. here manifest below:
<activity android:name=".activities.mainactivity" android:label="@string/app_name" android:launchmode="singletop" android:screenorientation="portrait" > </activity> <activity android:name=".activities.messagelistactivity" android:icon="@drawable/ic_action_email" android:label="@string/title_activity_text" android:launchmode="singletop" android:parentactivityname=".activities.mainactivity" android:screenorientation="portrait" > <meta-data android:name="android.support.parent_activity" android:value=".activities.mainactivity" /> </activity> <activity android:name=".activities.messageactivity" android:icon="@drawable/ic_action_read" android:label="@string/title_activity_text_message" android:parentactivityname=".activities.messagelistactivity" android:screenorientation="portrait" > <meta-data android:name="android.support.parent_activity" android:value=".activities.messagelistactivity" /> </activity>
the problem i'm trying implement notifications, if i'm out of app running service can still receive messages. when new message received popup shown , want click it, show messageactivity (c), when or pressed return messagelistactivity (b). open notification , messageactivity (c) shown expected, when press or takes me mainactivity (a). should return messagelistactivity (b) @ point!
to clarify :-
- notification appears
- user clicks it
- c opened
- user presses or up
- b should open, opens instead.
i have created backstack in notification shown below:
intent resultintent = new intent(nursecallapplication.getcontext(), messageactivity.class); taskstackbuilder stackbuilder = taskstackbuilder.create(nursecallapplication.getcontext()); stackbuilder.addparentstack(messageactivity.class); stackbuilder.addnextintent(resultintent); resultintent.putextra("messageobject", message); pendingintent resultpendingintent = pendingintent.getactivity(nursecallapplication.getcontext(), 0, resultintent, pendingintent.flag_update_current);
and in , button in messageactivity (c) have got:
navutils.navigateupfromsametask(this);
at point i'm throwing kinds trying figure out forgive me if there unnecessary parts in! massivelyyy appreciated! thanks!
i think error solve :
// b -> c when user clicks notification stackbuilder.addparentstack(messagelistactivity.class);
Comments
Post a Comment