Jaeger
Jaeger

Reputation: 1716

Launching An External Shortcut

I'm trying to launch an external shortcut, What i have is only the activity path .

Here's what i did :

        try {
            view.getContext().startActivity(Intent.getIntentOld(List.getShortcutPath());
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }

Log :

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=com.sonyericsson.music.ArtistShortcutActivity }

The Path I'm trying to launch :

com.sonyericsson.music.ArtistShortcutActivity

How to launch the shortcut ?

Upvotes: 0

Views: 43

Answers (1)

kreed
kreed

Reputation: 46

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.example", "com.example.MyExampleActivity"));
startActivity(intent);

if you get permission denial error, then add android:exported XML attribute is true in the manifest for the activity you want to launch

Here com.example is the package name of the app your activity that you want to launch is in, and com.example.myexampleactivity the full name of the activity you want to launch

If the intended activity to launch is package private, then you wont be able to launch it from a foreign application activity. This is done for security reasons by Google

Upvotes: 3

Related Questions