Ty Smith
Ty Smith

Reputation: 2594

Starting an external activity, getting permission error

I'm trying to start the preferences activity in the native messenger client from my application. in AOSP Mms.apk does not have an intent filter setup on that activity. Regardless I'm trying to find a work around to launch the user into that screen.

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setComponent(ComponentName.unflattenFromString("com.android.mms/com.android.mms.ui.MessagingPreferenceActivity"));
    intent.addCategory("android.intent.category.LAUNCHER");
    try {
        startActivity(intent);
    } catch (Exception e) {
        AppUtils.alertError(this, error);
    }

I'm receiving

java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.android.mms/.ui.MessagingPreferenceActivity } from ProcessRecord{406e2738 674:com.handmark.genericapp/10034} (pid=674, uid=10034) requires null

Any thoughts?

Upvotes: 0

Views: 644

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006819

What you want is not possible. That activity is not exported (at least in the source code showing in Google Code Search), so you cannot start it, except by rewriting the app as part of your own custom firmware.

Also, bear in mind that this app may or may not exist on any given device.

Upvotes: 1

Related Questions