I use short cut to start an activity with an action and parameters.
fun makeShortcut(id: String, @StringRes shortLabel: Int, @StringRes longLabel: Int,
@DrawableRes icon: Int, action: String, cmd: String): ShortcutInfo {
return ShortcutInfo.Builder(context(), id)
.setShortLabel(context().getString(shortLabel))
.setLongLabel(context().getString(longLabel))
.setIcon(Icon.createWithResource(context(), icon))
.setIntents(arrayOf(
Intent(action).putExtra(KEY_CMD, cmd)
))
.build()
}
After starting the activity, I do some stuff and finish the activity. The I launch the activity from task manager. The value passed by KEY_CMD is still exists. I want to clear the values when activity enter from task manager.