android - TaskStackBuilder addParentStack() method doesn't work -
i need flow that: when notification appears , user clicks it, activityb should start, if user clicks button should go activitya, problem that, when user clicks notification , activityb being lanched, stack empty , if user clicks button application behavior pressing home button , after click launcher icon, starts launcher activity, flow first time launch.
also saw google's official documentation how use notifications correctly preserving activities better navigation experience, did not help.
this code displays notification
private fun sendnotification() { val mbuilder = notificationcompat.builder(this) .setcontenttitle(name) .setcontenttext(messagebody) val resultintent = intent(this, activityb::class.java) val stackbuilder = taskstackbuilder.create(this) stackbuilder.addparentstack(activitya::class.java) stackbuilder.addnextintent(resultintent) val resultpendingintent = stackbuilder.getpendingintent(0, pendingintent.flag_update_current) mbuilder.setcontentintent(resultpendingintent) mnotificationmanager.notify(mid, mbuilder.build()) }
and here manifest file
<activity android:name=".activityb" android:parentactivityname="activitya" /> <activity android:name="activitya"/>
i don't understand, i'm missing
Comments
Post a Comment