This is how I process deep link in my Activity.
I was wondering, how can I remove it from intent, after I had finished process it?
@Override
public void onCreate(Bundle savedInstanceState) {
Utils.updateTheme(this);
super.onCreate(savedInstanceState);
Uri uri = this.getIntent().getData();
if (uri != null && uri.isHierarchical()) {
if (Constants.INVESTING_DEEP_LINK_PATH.equals(uri.getPath())) {
// Processing deep link...
// How can I remove deep link information from intent, after
// finished procesing deep link...
}
}
}
I want to prevent the same data, when this activity onCreate
is being executed again. For example, during configuration changes.
According to OPs, we can use the following way, to remove deep link info from intent after finished processing. However, it will yield another problem.
@Override
public void onCreate(Bundle savedInstanceState) {
Utils.updateTheme(this);
super.onCreate(savedInstanceState);
Uri uri = intent.getData();
if (uri != null && uri.isHierarchical()) {
if (Constants.INVESTING_DEEP_LINK_PATH.equals(uri.getPath())) {
// Processing deep link...
intent.setData(null);
setIntent(intent);
}
}
}
As @vlatkozelka mentioned, all you need to do is :
Intent clonedIntent = getIntent();
clonedIntent.setData(null);
and you are good to use clonedIntent
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With