0%

启用第三方应用的Activity报java.lang.SecurityException: Permission Denial的解决

调用方法:

        Intent intent = new Intent();
        ComponentName comp = new ComponentName("cn.xxx.chat","cn.xxx.chat.Chat_");
        intent.setComponent(comp);
        startActivity(intent);

解决方法: 在AndroidManifest.xml,Chat_声明时,加入intent-filter

        <activity
            android:name=".Chat_"
            android:label="@string/title_activity_chat"
            android:launchMode="singleInstance"
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:windowSoftInputMode="stateHidden" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>