TheLettuceMaster
TheLettuceMaster

Reputation: 15734

Eclipse Warning with Exported Activity Permission

I have this in my Android manifest:

   <activity
        android:name=".Planner"
        android:label="---" >
        <intent-filter>
            <action android:name="com.---.---.PLANNER" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

But I get the warning in Eclipse: Exported Activity Does not Require Permission

So I rework it to be like this:

 <activity
            android:name=".Planner"
            android:label="---" />

Warning goes away, but it force closes once this Activity is brought up. Here is LogCat:

11-29 19:22:03.569: E/AndroidRuntime(434): FATAL EXCEPTION: main
11-29 19:22:03.569: E/AndroidRuntime(434): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.---.---.PLANNER }
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.app.Activity.startActivityForResult(Activity.java:2827)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.app.Activity.startActivity(Activity.java:2933)
11-29 19:22:03.569: E/AndroidRuntime(434):  at com.---.---.ManageDebts$3.onClick(ManageDebts.java:135)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.view.View.performClick(View.java:2485)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.view.View$PerformClick.run(View.java:9080)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.os.Handler.handleCallback(Handler.java:587)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.os.Handler.dispatchMessage(Handler.java:92)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.os.Looper.loop(Looper.java:123)
11-29 19:22:03.569: E/AndroidRuntime(434):  at android.app.ActivityThread.main(ActivityThread.java:3683)
11-29 19:22:03.569: E/AndroidRuntime(434):  at java.lang.reflect.Method.invokeNative(Native Method)
11-29 19:22:03.569: E/AndroidRuntime(434):  at java.lang.reflect.Method.invoke(Method.java:507)
11-29 19:22:03.569: E/AndroidRuntime(434):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-29 19:22:03.569: E/AndroidRuntime(434):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-29 19:22:03.569: E/AndroidRuntime(434):  at dalvik.system.NativeStart.main(Native Method)

Here is line 135:

startActivity(new Intent("com.---.---.PLANNER"));

Upvotes: 0

Views: 85

Answers (2)

Robin Chander
Robin Chander

Reputation: 7415

This warning means you that you are making your activity publicly available without a securing a permission for it.

Change you manifest to

<activity
    android:name=".Planner"
    android:label="---" 
    android:exported = "false"
>

Upvotes: 2

John P.
John P.

Reputation: 4388

You need to use a different intent. Use

Intent intent = new Intent(YourFirstClass.this, PlannerActivity.class);
startActivity(intent);

Where PlannerActivity is the name of your activity as you see it in Eclipse.

Upvotes: 1

Related Questions