On Tue, Jul 3, 2012 at 11:50 AM, Bryan Ashby <[email protected]> wrote: > Part of my applications duties are to enumerate "launcher" activities -- to > do this, I call PackageManger.queryIntentActivities(). On some devices this > has resulted in a TransactionTooLargeException. Is there a way around this? > > Example code: >> >> final PackageManager pm = getPackageManager(); >> Intent intent = new Intent(Intent.ACTION_MAIN, null); >> intent.addCategory(Intent.CATEGORY_LAUNCHER); >> final List<ResolveInfo> ri = pm.queryIntentActivities(intent, 0); // >> TransactionTooLargeException
Well, I'd at least consider adding MATCH_DEFAULT_ONLY on the queryIntentActivities() call, if you are building a launcher-type app. Beyond that, I'm not sure if by default you get everything in the GET_ series of flags -- if so, that might be the source of your woe, and expressly listing the GET_ flags you really need might help. Basically, TransactionTooLargeException means you're trying to retrieve > 1MB (IIRC) from a foreign process. In this case, the user has too many apps installed, presumably. > I'd > expect that in this case if the underlying implementation is limited to 1M > that the query is done in batches and hidden from the developer or that an > API exists to do it in batches myself. Yeah, I don't know how you would do "page at a time" type stuff here. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.7 Available! -- 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

