当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Is it possible to remove a particular app in chooser while opening a URL?

问题描述:

My own app contains an intent filter which accepts a URL of "https:www.xyz.com"

While opening a particular URL from my own app, for example "https:www.xyz.com/signup",

it gives an option of my app also in chooser, but for this particular URL, I want to open it in browser only.

Please suggest me a proper way exclude my own app from default chooser list of android.

Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("https:www.xyz.com/signup"));

startActivity(Intent.createChooser(browserIntent, "Open with"));

网友答案:

but I need to exclude only a particular URL only i.e. "https:www.xyz.com/signup".

That is not possible. The URLs expressed in <data> elements in an <intent-filter> are a whitelist, not a blacklist or a combination. If you advertise that you support all URLs, you support all URLs, not all URLs minus one.

Hence, you need more constrained <intent-filter> elements that limit your URLs to those that you want to support, not all URLs within your domain.

分享给朋友:
您可能感兴趣的文章:
随机阅读: