I'm creating app for site and i created link redirector activity(for http://*.domain.com urls only), that redirect to activity if url support. If not support should open link in browser. It's working ok, but when user setting app default app, clicking always button in activity chooser, app goes to loop. activity opening, checking link support, if not support opening intent with Intent.ACTION_VIEW
flag then activity opens again.
Question : How to open link in browser (may be default), instead of my app, that set default for url.
My method that i trying open url in browser :
private void unsupportedLink() {
Toast.makeText(this, R.string.unsupported_link, Toast.LENGTH_LONG).show();
Intent openUrl = new Intent(Intent.ACTION_VIEW, Uri.parse(url.toString()));
startActivity(openUrl);
finish();
}
Activity in manifest :
<activity
android:name=".util.UrlHandler"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:pathPattern="/.*"
android:host="m.domain.com" />
<data
android:scheme="http"
android:pathPattern="/.*"
android:host="www.domain.com" />
</intent-filter>
</activity>