Android deep link, open web browser when link is not supported

I created an intent filter that uses this:

<action android:name="android.intent.action.VIEW" />

      

and registered the url to open my app when clicked. This works as intended until I try to locate a link that I don't support. Let's say I am doing some processing in my main activity, determine that the link is not supported, and try starting a web browser. This is what I am using:

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(launchUrl));
activity.startActivity(browserIntent);

      

Now the problem is that this link is still registered to open my application. It essentially creates a routing loop where it constantly opens my application every time I try to start the browser. Is there a way to force the browser to open and not allow my application to intercept it a second time?

+3


source to share





All Articles