[android-developers] Re: Clicking a link in Browser initates a new Intent
On Jan 6, 2:55 pm, Mark Murphy mmur...@commonsware.com wrote: Now, if I click a link in an email, I get the dialog where I can choose whether to open the link with my app or with Browser. This is all well and good, but I also get this dialog whenever I click a link in the Browser app, or even enter a URL in the address field! That's what you specified in the intent filter -- you claim to support every HTTP(S) URL everywhere regardless of MIME type, host, or anything else. That is correct, yes. That's why the intent filter is evil. Evil is a bit harsh, isn't it? :) After all, it's pretty much the same filter used by Browser (with the omission of about: URIs) Is there a way to circumvent this behavior in the Browser app, yet still present my app as an option when clicking links in email clients and the like? Intent filters are agnostic to the sender of the Intent, so anything in the system could send an Intent that your intent filter will match. Then, if the sender uses Intent.createChooser(), like the Browser app does, you will appear as a viable option. I guess this part is my actual problem. I can see why the email app would invoke ResolverActivity, but why the Browser would do this for every clicked link and every entered URL is unclear to me. As mentioned, Steel doesn't do this. Setting Steel to the default URL handler will therefore, in effect, render the Browser app unusable since any click or address entry in Browser will be sent to Steel. It seems like the answer to my question is no then? Furthermore, you really need to more tightly constrain that intent filter, so it is only going to be used for MIME types you actually will support, or only from certain sites, or something. Look at the data element in the SDK documentation: Well, the MIME type of a HTTP(S) resource will be unknown until the network resource is opened, won't it? For example when I click a link in an email. Anyway, since text/html and application/xhtml+xml are among the MIME types I'm interested in, I guess it wouldn't help me if I did know the type beforehand; Browser would still pop up a chooser that contained my app along with Browser itself. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Clicking a link in Browser initates a new Intent
Evil is a bit harsh, isn't it? :) After all, it's pretty much the same filter used by Browser (with the omission of about: URIs) Evil is perhaps harsh, but...are you implementing a Web browser? For example when I click a link in an email. Anyway, since text/html and application/xhtml+xml are among the MIME types I'm interested in, I guess it wouldn't help me if I did know the type beforehand; Browser would still pop up a chooser that contained my app along with Browser itself. Yup. This is not significantly different than on other platforms. For example, I have no idea how you'd tell Windows that you are the default handler for http:// URLs...but only if they are launched from Outlook and not from other apps. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Clicking a link in Browser initates a new Intent
This is not significantly different than on other platforms. For example, I have no idea how you'd tell Windows that you are the default handler for http:// URLs...but only if they are launched from Outlook and not from other apps. Well, to use the Windows analogy, I'd be happy to open links from Thunderbird and MSN Messenger as well, but probably not Chrome or IE. The Android browser is different in the respect that if you tell Windows that you are the default handler for HTTP URLs, IE will still be able to both open a web page and follow its links without launching the newly set default browser. In fact, having a browser ask you which app you want to open a web page in every time you click a link seems a bit redundant. Oh well, seems like I'll need to figure out some not- too-nasty hack. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en