I've seen a few other similar threads, but none that both matched my
problem and had answers, so sorry if this retreads familiar ground.

I've got a browser and I'm trying to catch the same intents as the
google browser. I've even gone so far as to copy and paste them
directly from Froyo's browser. They are listed down below for
reference. However, when I try to send an intent to create the chooser
so the user can select my browser as the default it does not always
appear. Here is the code for creating the intent:

Intent anIntent = new Intent("android.intent.action.VIEW", "http://
www.google.com");
anIntent.addCategory(Intent.CATEGORY_BROWSABLE);
startActivity(anIntent);

and the logcat output:

08-26 14:53:25.698: INFO/ActivityManager(85): Starting activity:
Intent { act=android.intent.action.VIEW
cat=[android.intent.category.BROWSABLE] dat=http://www.google.com
cmp=com.android.browser/.BrowserActivity }

For some reason the intent is automatically resolving to Google's
browser unless one of the following is true:

1) I've cleared the defaults from the google browser via application
settings,
2) I've installed a third browser, or even just a HelloWorld app with
the intent-filters listed below, or
3) I'm running on a platform earlier than 2.2

What is really confusing is #2. It doesn't matter what that third app
is. I've used a default hello world with just the first intent-filter
and that's enough to trigger something behind the scenes that tells
Google it's no longer the only default browser. However, it's not
enough in my own app, and the only differences in the two manifests
are that mine has a sharedUserId, a couple of extra activities (none
of which have intent-filters) and permissions (none of which have
anything to do with browsing, in fact HelloWorld doesn't have any
permissions at all).

The program flow is: user opens browser, it sees that it's not fully
installed and opens another activity, that activity does some stuff
(none of which deals with intents) and then checks to see if my
browser is the default, if not it fires off the aforementioned intent
to create the chooser so the user can set the default.

Is there a change in froyo that would cause an application to not be
able to use startActivity with a generic intent that matches to its
own package? Or some other change to the way activities are resolved
or installed that broke the way preferred activities are defined? I
know that the PackageManager preferred activity functions have
changed, but I'm not using them at all.

----- the intent-filters -----
<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" />
        <data android:scheme="https" />
        <data android:scheme="about" />
        <data android:scheme="javascript" />
</intent-filter>
<!--  For these schemes where any of these particular MIME types
          have been supplied, we are a good candidate. -->
<intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:scheme="http" />
        <data android:scheme="https" />
        <data android:scheme="inline" />
        <data android:mimeType="text/html"/>
        <data android:mimeType="text/plain"/>
        <data android:mimeType="application/xhtml+xml"/>
        <data android:mimeType="application/vnd.wap.xhtml+xml"/>
</intent-filter>
<!-- We are also the main entry point of the browser. -->
<intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

-- 
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

Reply via email to