On Fri, Nov 19, 2010 at 2:51 PM, jotobjects <jotobje...@gmail.com> wrote:
> So maybe I should doing a PackageManager.queryIntentActivityOptions > for an Intent with CATEGORY_LAUNCHER and URI scheme "http". and then > use the ResolveInfo to start the Activity. Does that sound right? > > String packageName = resolveInfo.activityInfo.packageName; > String activityName = resolveInfo.activityInfo.name; > Intent intent = new Intent(); > intent.setComponent( new ComponentName( packageName, > activityName ) ); > Not queryIntentAcitivityOptions(), that is for something else. You could do queryIntentActivities() and see what all you get back. If the user has more than one web browser installed, you'll need to decide how you want to handle that. > > That Intent is okay, though there is no need for BROWSABLE. (As per the > > documentation, BROWSABLE means that the Intent came from an untrusted > source > > so you want to restrict who will handle it to those that say they will > > protect themselves from such things.) > That surprises me because I interpreted the javdoc for Intent to say > that if you include a Category you must include ALL the categories > listed for that Intent. So if BROWSABLE is a category you would have > to include it - is that right? > Not sure what you mean here. If you include a category in an Intent, then it must be in an IntentFilter for that filter to match. I don't really know what you mean by "all the categories listed for an Intent." You put the categories you want in an Intent, to appropriately restrict down what it will match. > > I'm not sure what you mean by "empty URI" -- it says "empty string", > which > > would just be a Uri created from an empty string. > The referenced documentation about WEB_SEARCH caused me to try this > intent - > new Intent(Intent.ACTION_WEB_SEARCH, Uri.parse("")); > but that results in this error - > android.content.ActivityNotFoundException: No Activity found to handle > Intent { act=android.intent.action.WEB_SEARCH dat= } > So I'm not sure what the documentation means here. What should I be > doing? > >From the intent filter on the browser activity, it seems to me like that should work. You can try setting the Intent flag to log intent resolver matching to see why it is getting rejected. (This empty Uri is kind-of a wacky thing to do, anyway, though; I am not thrilled about this being documented and used as a normal mechanism. :p) -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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