On Aug 5, 3:55 am, Mark Murphy <[email protected]> wrote:
> On Fri, Aug 5, 2011 at 1:38 AM, John <[email protected]> wrote:
> > The error is "Application is not installed", which seems to be some
> > generic android error which gives no real information for why the
> > action is not working.
>
> No, it is a very specific error, indicating that the application you
> think you are trying to launch is not installed.
>
> > Intent shortcutIntent = getAppLauncherIntent("com.google.android.gm");
>
> Don't hard-code packages. Use PackageManager and
> queryIntentActivities() to determine what the launchable activities
> are.
Thanks Mark.
I'm sorry for my confusion, but the concept of "application is not
installed" must have a semantic to android developers that I don't
understand. I was using PackageManager.getInstalledPackages to find
the package originally. So I figured, after your response, that it
must have something to do with the Intent I was using. So I tried
this:
getLauncherActivities();
private ArrayList<ResolveInfo> getLauncherActivities()
{
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
return getIntentActivities(intent);
}
private ArrayList<ResolveInfo> getLauncherActivities(Intent intent) {
ArrayList<ResolveInfo> ret = new ArrayList<ResolveInfo>();
List<ResolveInfo> packs =
getPackageManager().queryIntentActivities(intent, 0);
for(int i=0; i<packs.size(); i++) {
ResolveInfo ri = packs.get(i);
ret.add(ri);
}
return ret;
}
In the case of the Gallery application i.e.
"com.google.android.gallery3d", which throws the "Application is not
installed" error in the shortcut, it shows up both in
getInstalledPackages and also in queryIntentActivities with the given
Intent, also it only has one entry in the queryIntentActivities which
confuses me even more. If it had more than one entry, that would make
sense to me, I would need to specify which className to invoke.
Anyways, very confused and hoping someone can help me out.
Thanks,
John
--
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