2

I need to allow user to draw/sketch/paint something. There are already many apps(like Skitch, I will use this as an example) that accomplish this task. So I don't want to re-invent the wheel.
In Android, theoretically, we can launch other activity by intent. This is sort of like "pipe" in Unix.
The problem is, I don't know how to get the information for launching Skitch.
To integrate Skitch in my app, I need to know the Action it supports, the returning intent (if any) when it finishes.

I installed Skitch, photoshop, and lots of other touch drawing apps in my device, but this code doesn't work :

Uri data = Uri.fromFile(file);
Intent i = new Intent(Intent.ACTION_EDIT);
i.setData(data);
i.setType("image/*");                               
startActivityForResult(i, ACTIVITY_DRAW);

I can launch Skitch from my app in the following way: but obviously I can't get any returned result this way(code from here).

Intent i = new Intent(Intent.ACTION_MAIN);
PackageManager manager = getPackageManager();
i = manager.getLaunchIntentForPackage("com.evernote.skitch");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);

My question: Is there a standard way to find information for launching a third party app?
Is this site the only way to share/get such information?
Or if you have any suggestions for my problem, please help me.
Thank you!

Community
  • 1
  • 1
Ben Lee
  • 3,418
  • 1
  • 18
  • 19

2 Answers2

3

As you might already know how to call another application Activity from your app ..this way Mentioned Here.

Intent intent = new Intent(Intent.ACTION_RUN); 
intent.setComponent(new ComponentName("<packet name>", "<class name>")); 
List list = packageManager.queryIntentActivities(intent, packageManager.COMPONENT_ENABLED_STATE_DEFAULT); 

if(list.size() > 0) 
{ 
 Log.i("Log", "Have application" + list.size()); 
 startActivity(intent); 
} 
else 
{ 
    Log.i("Log", "None application"); 
} 

All your require is Mainly Two Things to call any Activity

1) Package Name of that Activity 2) Activity Class Name

These two informations only can be available if they are opensource or made free to use .. like Zxing,Google Maps Application.

There is another way to start an application activity like,

Intent intent = new Intent();
intent.setAction(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + numberField.getText())); // set the Uri
startActivity(intent);

For this way to use need to know the correct Action for the Activity you want to call and the Correct parameter to pass with.

And again,These information only can be available if they are opensource or made free to use .. like Facebook and Gmail apps to share and post messages.

So If you are searching for anything like which can tell you what you will need to pass to call any specific comercial apps in your device, you wont find it directly.

Community
  • 1
  • 1
MKJParekh
  • 34,073
  • 11
  • 87
  • 98
  • Thanks for your help Frankenstein! I decide to contact Skitch(and maybe more other team) to see if they could provide such information. – Ben Lee Apr 17 '12 at 06:56
0

It's an old question but perhaps it could help somebody to know that Sony's AppXplore application (free) shows the package and name of the activities of every app installed on your device, so you can eventually use them to do explicit Intents.

cifuentes
  • 1,229
  • 1
  • 8
  • 6