android - Activity back stack button from push intent -


when click push notification(from app), intent trigger , open message activity. stack arrow close app in way. how add appropriate activity stack / flag use return previous activity (not close app), there necessary override onnewintent()?

thanks

you can either add parent activity have deep linked in manifest, or can add state when starting activity.

manifest:

<application ... > ... <!-- main/home activity (it has no parent activity) --> <activity     android:name="com.example.myfirstapp.mainactivity" ...>     ... </activity> <!-- child of main activity --> <activity     android:name="com.example.myfirstapp.displaymessageactivity"     android:label="@string/title_activity_display_message"     android:parentactivityname="com.example.myfirstapp.mainactivity" >     <!-- meta-data element needed versions lower 4.1 -->     <meta-data         android:name="android.support.parent_activity"         android:value="com.example.myfirstapp.mainactivity" /> </activity> 

java:

// intent activity open when user selects notification intent detailsintent = new intent(this, detailsactivity.class);  // use taskstackbuilder build stack , pendingintent pendingintent pendingintent =         taskstackbuilder.create(this)                         // add of detailsactivity's parents stack,                         // followed detailsactivity                         .addnextintentwithparentstack(upintent)                         .getpendingintent(0, pendingintent.flag_update_current);  notificationcompat.builder builder = new notificationcompat.builder(this); builder.setcontentintent(pendingintent); 

reference: https://developer.android.com/training/implementing-navigation/temporal.html


Comments

Popular posts from this blog

php - Auto increment employee ID -

php - isset function not working properly -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -