Re: [android-developers] Re: 3rdParty application icon

2011-08-07 Thread Mark Murphy
On Sat, Aug 6, 2011 at 8:39 PM, John android...@gmail.com wrote:
 Thanks Mark, much appreciated, that works. Just to let you
 com.google.android.gallery3d is the package name, but for some
 reason simply calling setPackage() on the intent works for some
 packages but not others.

That package name might be new to Honeycomb. The source code we have
access to only goes up to Gingerbread, and I notice that you're trying
this on an EEE Pad Transformer (or something else in the EEE Pad
family).

 Now, that I know the issue, I suppose
 Application is not installed makes sense, although it would be nice
 if it could resolve to a more meaningful message.

The problem is, more meaningful to you won't be any more meaningful
to the *user*, most likely. Assuming the shortcut ever worked, the
most likely scenario for a user is that the shortcut points to an
application that wasn't installed. LogCat may have had more details
for you as a developer.

-- 
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 *Advanced* Android Development_ Version 2.0
Available!

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


Re: [android-developers] Re: 3rdParty application icon

2011-08-06 Thread Mark Murphy
On Sat, Aug 6, 2011 at 1:46 AM, John android...@gmail.com wrote:
 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.

com.google.android.gallery3d doesn't exist in the Android open source
project (at least Google Code Search doesn't turn it up), and the
Gallery3D project doesn't use that package.

Have you tried creating a shortcut based on the actual ResolveInfo
object? Here's the code snippet for creating such an Intent:

Intent buildLauncherIntent(ResolveInfo launchable) {
ActivityInfo activity=launchable.activityInfo;
ComponentName name=new 
ComponentName(activity.applicationInfo.packageName,

 activity.name);
Intent i=new Intent(Intent.ACTION_MAIN);

i.addCategory(Intent.CATEGORY_LAUNCHER);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |

Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
i.setComponent(name);

return(i);
}

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 3.5 Available!

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


[android-developers] Re: 3rdParty application icon

2011-08-06 Thread John
Thanks Mark, much appreciated, that works. Just to let you
com.google.android.gallery3d is the package name, but for some
reason simply calling setPackage() on the intent works for some
packages but not others. Now, that I know the issue, I suppose
Application is not installed makes sense, although it would be nice
if it could resolve to a more meaningful message.

John


On Aug 6, 4:32 am, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Aug 6, 2011 at 1:46 AM, John android...@gmail.com wrote:
  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.

 com.google.android.gallery3d doesn't exist in the Android open source
 project (at least Google Code Search doesn't turn it up), and the
 Gallery3D project doesn't use that package.

 Have you tried creating a shortcut based on the actual ResolveInfo
 object? Here's the code snippet for creating such an Intent:

 Intent buildLauncherIntent(ResolveInfo launchable) {
                 ActivityInfo activity=launchable.activityInfo;
                 ComponentName name=new 
 ComponentName(activity.applicationInfo.packageName,
                                                                               
                            activity.name);
                 Intent i=new Intent(Intent.ACTION_MAIN);

                 i.addCategory(Intent.CATEGORY_LAUNCHER);
                 i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                                                                 
 Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                 i.setComponent(name);

                 return(i);

 }

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 _Android Programming Tutorials_ Version 3.5 Available!

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


[android-developers] Re: 3rdParty application icon

2011-08-05 Thread John


On Aug 5, 3:55 am, Mark Murphy mmur...@commonsware.com wrote:
 On Fri, Aug 5, 2011 at 1:38 AM, John android...@gmail.com 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 ArrayListResolveInfo getLauncherActivities()
{
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
return getIntentActivities(intent);
}

private ArrayListResolveInfo getLauncherActivities(Intent intent) {
ArrayListResolveInfo ret = new ArrayListResolveInfo();
ListResolveInfo packs =
getPackageManager().queryIntentActivities(intent, 0);
for(int i=0; ipacks.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 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