简体   繁体   中英

Android Auto - launch third party app from within my app?

Is it possible to launch any third party application from my application on Android Auto I couldn't find anything mentioned on this anywhere.

Note: Please note "Android Auto" (Car) words here. I am not asking for android mobile application.

Idea of android auto is completely different from what you are trying to do.

Android auto provides a platform where it has done the basic things with a good user interface making sure not to distract user much.

All that you need to do is provide services which this platform can use. As of now you can provide Music and Messaging services which are compatible with android auto.

You can launch applications code something like

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.example.youpackage", "com.example.LauchActivity");
startActivity(intent);

And if you want get all possible application list for launch.code :

Declare you intent and add value you want pass

PackageManager packageManager = getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0);
boolean isIntentSafe = activities.size() > 0;
if (isIntentSafe) {
    startActivity(mapIntent);
}

And another way to start you specific application

PackageManager pm = getPackageManager();
Intent intent = pm.getLaunchIntentForPackage("com.example.package");
startActivity(intent);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM