I have a scenario where my app will catch a particular URL(call primary URL) through an intent filter and send this URL to an API which gives me a secondary URL and based on this secondary URL I will navigate the user to an in-app destination however when the API fails or when there is no in-app destination the want the user to be redirected to web
However, When I try to redirect the user to the web using the primary URL. My intent filter is being triggered again and it is giving the option to open the link in my app (which my app is not capable to handle). Things get worse when the user selects to open the link with my app always (in the android prompt). My app always tries to catch the URL and it goes into an infinite loop
How to remedy this