Have you tried using a standard intent to open the browser with the URL "about:blank" ?
Maybe not exactly what you want, but simple and likely to work everywhere. On Fri, Nov 19, 2010 at 5:51 PM, jotobjects <[email protected]> wrote: > Thanks - > > I don't have a URL to launch and I don't want to land on the google > web search page. The behavior I want is what happens when the user > launches the browser from the Home screen. > > 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 ) ); > > > > There are a couple of more followup questions inline below - > > On Nov 18, 5:46 pm, Dianne Hackborn <[email protected]> wrote: >> 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? > >> >> 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? > > >> >> >> >> On Thu, Nov 18, 2010 at 5:05 PM, jotobjects <[email protected]> wrote: >> > Thanks - I was afraid of that (although it is not quite blind luck). >> >> > The user's home page would be an obvious target, but there doesn't >> > seem to be a non blind luck way to find the home web page. The >> > browser seems to bring up the last page visited which is OK since that >> > will be customary behavior for the user. >> >> > I also tried this, which works but lands the user on thewww.google.com >> > web page with "http" in the input window. Is this a valid Intent? >> >> > Intent webIntent = new Intent(Intent.ACTION_VIEW,Uri.fromParts("http", >> > "", null)); >> > webIntent.addCategory(Intent.CATEGORY_DEFAULT); >> > webIntent.addCategory(Intent.CATEGORY_BROWSABLE); >> >> > Also I do not understand this documentation for how to bring up the >> > web browser - >> >> > http://developer.android.com/guide/appendix/g-app-intents.html >> >> > The WEB_SEARCH action mentioned there with an "empty" URI sounds like >> > what I want, but I can't figure out how to create an "empty URI" that >> > works. >> >> > On Nov 18, 2:52 pm, Dianne Hackborn <[email protected]> wrote: >> > > That is a bogus Intent; it is just blind luck that it happens to only run >> > > into the browser as something that happens to match it, and you can't >> > count >> > > on that doing what you want anywhere else. >> >> > > I don't believe there is a generic action to start "the browser;" you are >> > > supposed to start it by asking it to view a URI. >> >> > > On Thu, Nov 18, 2010 at 2:39 PM, jotobjects <[email protected]> >> > wrote: >> > > > I want to invoke the internet browser app without giving it a URL to >> > > > open. I have tried a couple of things. What seems to work is this - >> >> > > > Intent webIntent = new Intent(Intent.ACTION_MAIN); >> > > > webIntent.addCategory(Intent.CATEGORY_LAUNCHER); >> > > > webIntent.addCategory(Intent.CATEGORY_DEFAULT); >> > > > webIntent.addCategory(Intent.CATEGORY_BROWSABLE); >> > > > context.startActivity(webIntent); >> >> > > > Is there another or better Intent to use? Is it good practice to use >> > > > the Launcher Intent for an app in this way? >> >> > > > -- >> > > > You received this message because you are subscribed to the Google >> > > > Groups "Android Developers" group. >> > > > To post to this group, send email to >> > [email protected] >> > > > To unsubscribe from this group, send email to >> > > > [email protected]<android-developers%[email protected]> >> > <android-developers%[email protected]<android-developers%[email protected]> >> >> > > > For more options, visit this group at >> > > >http://groups.google.com/group/android-developers?hl=en >> >> > > -- >> > > Dianne Hackborn >> > > Android framework engineer >> > > [email protected] >> >> > > 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 [email protected] >> > To unsubscribe from this group, send email to >> > [email protected]<android-developers%[email protected]> >> > For more options, visit this group at >> >http://groups.google.com/group/android-developers?hl=en >> >> -- >> Dianne Hackborn >> Android framework engineer >> [email protected] >> >> 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

