Launching another application from one application using webintent

208 views
Skip to first unread message

Imran

unread,
Dec 14, 2011, 6:37:25 AM12/14/11
to Web Intents
Hi

How can we launch another application from one application using
WebIntents?
Is it planned or ?

In case of android intents, its possible with action MAIN and category
LAUNCHER...
http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent
please see the code snippet at the end..

BR

private void launchComponent(String packageName, String name){
Intent launch_intent = new Intent("android.intent.action.MAIN");
launch_intent.addCategory("android.intent.category.LAUNCHER");
launch_intent.setComponent(new ComponentName(packageName, name));
launch_intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

activity.startActivity(launch_intent);
}

public void startApplication(String application_name){
try{
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");

intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
List<ResolveInfo> resolveinfo_list =
activity.getPackageManager().queryIntentActivities(intent, 0);

for(ResolveInfo info:resolveinfo_list){

if(info.activityInfo.packageName.equalsIgnoreCase(application_name)){
launchComponent(info.activityInfo.packageName,
info.activityInfo.name);
break;
}
}
}
catch (ActivityNotFoundException e) {
Toast.makeText(activity.getApplicationContext(), "There was a
problem loading the application:
"+application_name,Toast.LENGTH_SHORT).show();
}
}

Paul Kinlan

unread,
Dec 14, 2011, 8:57:50 AM12/14/11
to web-i...@googlegroups.com
Hi,

It is something that we are thinking about - letting you provide a "link" to the app that you want to launch if you know the details.

For v1 of the intent system we probably won't have it in unless there is a huge demand for it.

P
--
Paul Kinlan
Developer Advocate @ Google for Chrome and HTML5

Imran

unread,
Dec 14, 2011, 9:51:54 AM12/14/11
to Web Intents
Hi

Thanks for your reply...
Can you please give the idea about the changes in Intent interface in
such cases
e.g. in order to launch imageeditor application...
so would it be on based on the following lines:
var intent = new Intent;
intent.action = Intent.LAUNCH;
intent.data = 'imageeditor';

BR

On Dec 14, 3:57 pm, Paul Kinlan <paulkin...@google.com> wrote:
> Hi,
>
> It is something that we are thinking about - letting you provide a "link"
> to the app that you want to launch if you know the details.
>
> For v1 of the intent system we probably won't have it in unless there is a
> huge demand for it.
>
> P
>
>
>
>
>
>
>
>
>
> On Wed, Dec 14, 2011 at 11:37 AM, Imran <imran.za...@gmail.com> wrote:
> > Hi
>
> > How can we launch another application from one application using
> > WebIntents?
> > Is it planned or ?
>
> > In case of android intents, its possible with action MAIN and category
> > LAUNCHER...
>

> >http://stackoverflow.com/questions/2780102/open-another-application-f...

James Hawkins

unread,
Dec 14, 2011, 12:35:31 PM12/14/11
to web-i...@googlegroups.com
I think the most pertinent question we must ask is if the existing mechanisms for 'launching an app' in the web are not sufficient, e.g. links.  Do you have a use case that is not handled by a link with target="_blank"?

James

Paul Kinlan

unread,
Dec 14, 2011, 1:16:01 PM12/14/11
to web-i...@googlegroups.com
If we can combine the link with web intents that is very powerful.
Ultimately the link is a defined definite endpoint, however you will
want data, action and type to be passed along with the launch.
(essentially you will want the window.intent object populated).

P

Reply all
Reply to author
Forward
0 new messages