Sorry yes I am wrong again... it's been a while since I've looked at the code. :}
Okay so hopefully this will be right -- the method in the package manager for determining the default activity is not public (it is PackageManagerService.findPreferredActivity() fwiw). The only suggestion I can make is to just call resolveIntentActivity(), which will always only return a single activity, either the one matching activity, the current default if the user has picked a default, or the intent resolver if there is no default. On Tue, Aug 11, 2009 at 11:13 AM, George <[email protected]> wrote: > > Inspite of choosing a Default app for my intent, isDefault is set to > false to for both the ResolveInfos in my list. The order of the > ResolveInfo seems to be based on install time - I verified this by > choosing the second app in my Intent Resolver dialog and called > queryIntentActivities again; my default app still showed up second in > the list and isDefault was set to false. > > Also, the documentation of isDefault says nothing about it being the > default app, rather just that if the category of the intent was > DEFAULT - "This filter has specified the Intent.CATEGORY_DEFAULT, > meaning it would like to be considered a default action that the user > can perform on this data." (Related question: When does this become > true?) > > Any other pointers? Will PackageManager.getPreferredActivities help me > in anyway? > > -George > > On Aug 10, 8:41 pm, Dianne Hackborn <[email protected]> wrote: > > Oh sorry, you are right, this function always return the full list. They > > are ordered by how good they match the intent; if there is a default it > will > > be the first in the list with isDefault set to true. > > > > > > > > On Mon, Aug 10, 2009 at 7:24 PM, George <[email protected]> wrote: > > > > > That is not what I am seeing. > > > > > I have two email applications which handle > > > the same intent ie in their manifest files I have > > > <intent-filter> > > > <action android:name="com.xxxx.compose'/> > > > <category android:name="android.intent.category.DEFAULT/> > > > </intent-filter> > > > in my calling app, > > > Intent intent = new Intent(); > > > intent.setAction("com.xxxx.compose"); > > > when I call List<ResolveInfo> l =queryIntentActivities(intent, > > > PackageManager.MATCH_DEFAULT_ONLY); > > > l.size() always returns two -irrespective of chosing a default when > > > the intent resolver dialog is shown. > > > And the values in the resolveinfo list points to my email > > > applications. > > > > > I want to know programatically, if a default has been chosen by the > > > user. > > > On Aug 10, 6:40 pm, Dianne Hackborn <[email protected]> wrote: > > > > If the user has selected a default activity, that is the only one > that is > > > > returned. If they haven't, and there are multiple matching > activities, > > > than > > > > the system's intent resolver activity will be returned. > > > > > > On Mon, Aug 10, 2009 at 6:18 PM, George <[email protected]> wrote: > > > > > > > PacakgeManager.queryIntentActivities(Intent intent, int flags) > with > > > > > flags = MATCH_DEFAULT_ONLY returns a list of applications that > handle > > > > > a particular intent. How do I find the default activity that is > chosen > > > > > by the user? > > > > > > > Note: The default activity is chosen by the user the first time he > is > > > > > prompted with a list of applications that handle a particular > intent. > > > > > > -- > > > > 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. > > > > -- > > 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. > > > -- 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 -~----------~----~----~----~------~----~------~--~---

