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?
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.
精彩评论