问题描述
我已经创建了一个包含GWVectraNotifier活动被称为从其他应用程序,以显示通知的应用程序。
I have created an application containing GWVectraNotifier activity which is called from other applications to display Notification.
在通知对话框中,将有秀按钮和关闭按钮。
In the Notification dialog, there will be 'show' button and 'close' button.
的'秀'按钮的onclick,相应的活动将启动。
Onclick of 'show' button, the corresponding activity will be started.
要检查上述应用程序的功能,
To check the functionality of the above application,
我开始GWVectraNotifier活动从checkmail事件触发K9Mail应用程序。
I started the GWVectraNotifier activity from K9Mail application on checkmail event trigger.
我能够成功启动GWVectraNotifier活动,但的onclick的显示按钮,我将不得不开始K9mail.To的MessageList中的活动这样做,我写了下面的code:
I am able to start the GWVectraNotifier activity successfully, but onclick of 'show' button i will have to start 'MessageList' activity of K9mail.To do so, i wrote the below code:
Intent i = new Intent();
i.setComponent(new ComponentName("com.fsck.k9", "com.fsck.k9.activity.MessageList"));
i.putExtra("account", accUuid);
i.putExtra("folder", accFolder);
startActivity(i);
会抛出:
WARN/ActivityManager(59): Permission denied: checkComponentPermission() reqUid=10050
WARN/ActivityManager(59): Permission Denial: starting Intent { cmp=com.fsck.k9/.activity.MessageList (has extras) } from ProcessRecord{43f6d7c8 675:com.i10n.notifier/10052} (pid=675, uid=10052) requires null
WARN/System.err(675): java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.fsck.k9/.activity.MessageList (has extras) } from ProcessRecord{43f6d7c8 675:com.i10n.notifier/10052} (pid=675, uid=10052) requires null
WARN/System.err(675): at android.os.Parcel.readException(Parcel.java:1247)
WARN/System.err(675): at android.os.Parcel.readException(Parcel.java:1235)
WARN/System.err(675): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
WARN/System.err(675): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
WARN/System.err(675): at android.app.Activity.startActivityForResult(Activity.java:2817)
WARN/System.err(675): at android.app.Activity.startActivity(Activity.java:2923)
WARN/System.err(675): at com.i10n.notifier.GWVectraNotifier$2$1.run(GWVectraNotifier.java:63)
WARN/System.err(675): at android.app.Activity.runOnUiThread(Activity.java:3707)
WARN/System.err(675): at com.i10n.notifier.GWVectraNotifier$2.onClick(GWVectraNotifier.java:53)
WARN/System.err(675): at android.view.View.performClick(View.java:2408)
WARN/System.err(675): at android.view.View$PerformClick.run(View.java:8816)
WARN/System.err(675): at android.os.Handler.handleCallback(Handler.java:587)
WARN/System.err(675): at android.os.Handler.dispatchMessage(Handler.java:92)
WARN/System.err(675): at android.os.Looper.loop(Looper.java:123)
WARN/System.err(675): at android.app.ActivityThread.main(ActivityThread.java:4627)
WARN/System.err(675): at java.lang.reflect.Method.invokeNative(Native Method)
WARN/System.err(675): at java.lang.reflect.Method.invoke(Method.java:521)
WARN/System.err(675): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
WARN/System.err(675): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
WARN/System.err(675): at dalvik.system.NativeStart.main(Native Method)
其实我不能够了解哪些权限在我的通知应用程序的清单文件,包括访问k9Mail的MessageList中。我下面粘贴的权限包括在k9mail应用程序的清单文件:
Actually i am not able to understand what permissions to include in my Notifier application's manifest file to access MessageList of k9Mail. I am pasting below the permissions included in k9mail application's manifest file:
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.READ_OWNER_DATA"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="org.thialfihar.android.apg.permission.READ_KEY_DETAILS"/>
<permission android:name="com.fsck.k9.permission.READ_ATTACHMENT"
android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="dangerous"
android:label="@string/read_attachment_label"
android:description="@string/read_attachment_desc"/>
<uses-permission android:name="com.fsck.k9.permission.READ_ATTACHMENT"/>
<permission android:name="com.fsck.k9.permission.REMOTE_CONTROL"
android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="dangerous"
android:label="@string/remote_control_label"
android:description="@string/remote_control_desc"/>
<uses-permission android:name="com.fsck.k9.permission.REMOTE_CONTROL"/>
<permission android:name="com.fsck.k9.permission.READ_MESSAGES"
android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="normal"
android:label="@string/read_messages_label"
android:description="@string/read_messages_desc"/>
<uses-permission android:name="com.fsck.k9.permission.READ_MESSAGES"/>
<permission android:name="com.fsck.k9.permission.DELETE_MESSAGES"
android:permissionGroup="android.permission-group.MESSAGES"
android:protectionLevel="normal"
android:label="@string/delete_messages_label"
android:description="@string/read_messages_desc"/>
<uses-permission android:name="com.fsck.k9.permission.DELETE_MESSAGES"/>
能否有人告诉我,在我的应用程序中包含哪些权限?在上述权限的一些仅供k9mail,因为这些都是K9书面许可类。所以,我将只能够包括在上面给出的Android权限的内置权限。我试图这样做的很好,但它并没有解决我的问题:(
Can some one tell me which permission to include in my app? In the above permissions some are only for k9mail , because those are the permission classes written for k9. So, i will only be able to include the built-in permissions of android in the above given permissions. I tried by doing so as well, but it didn't solve my issue :(
推荐答案
您必须添加安卓出口=真正的
在你的活动清单文件尝试启动。
You have to add android:exported="true"
in the manifest file in the activity you are trying to start.
在android:exported文档:
安卓出口
是否活性可以通过其他应用程序的部件推出 - true表示它可以是,和假,如果不。如果假时,活动只能被具有相同的用户ID相同的应用程序或应用程序的组成部分推出。
默认值取决于该活动是否包含意图过滤器。不存在任何过滤器意味着活性可以通过指定其确切类名称仅调用。这意味着,该活动仅用于应用内部使用(因为其他人不知道类名称)。因此,在这种情况下,默认值是假。另一方面,至少一个过滤器的presence意味着该活动旨在供外部使用,所以默认值是真。
The default value depends on whether the activity contains intent filters. The absence of any filters means that the activity can be invoked only by specifying its exact class name. This implies that the activity is intended only for application-internal use (since others would not know the class name). So in this case, the default value is "false". On the other hand, the presence of at least one filter implies that the activity is intended for external use, so the default value is "true".
这个属性不是限制活动接触到其他应用程序的唯一途径。还可以使用一个权限来限制可以调用活动的外部实体(见许可属性)。
This attribute is not the only way to limit an activity's exposure to other applications. You can also use a permission to limit the external entities that can invoke the activity (see the permission attribute).
这篇关于安卓:java.lang.SecurityException异常:权限被拒绝:启动意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!