代码之家  ›  专栏  ›  技术社区  ›  Isaac Waller

Android主屏幕快捷方式权限错误

  •  10
  • Isaac Waller  · 技术社区  · 17 年前

    在我的程序中,它为屏幕添加了一个快捷方式。我可以在屏幕上看到图标,但当我点击它时,我会看到:

    03-01 20:00:29.410: ERROR/AndroidRuntime(796): java.lang.SecurityException: Permission Denial: starting Intent { data=http://www.example.com/ flags=0x14000000 comp={com.isaacwaller.example/com.isaacwaller.example.ExampleCut} } from ProcessRecord{435c7398 796:android.process.acore/10005} (pid=796, uid=10005) requires null
    


    艾萨克

    5 回复  |  直到 17 年前
        1
  •  11
  •   Malachi    15 年前

    <activity android:name=".ConventionHome" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    
    <activity android:name="ConventionHome"></activity>
    

        2
  •  9
  •   Isaac Waller    17 年前

    算出了,在下面加上这个 <activity> 活动标签:

    <intent-filter>
    <action android:name="android.intent.action.MAIN"></action>
    </intent-filter>
    
        3
  •  5
  •   Jeremy Logan    17 年前

    像这样的方法应该会奏效:

    <intent-filter>
        <action android:name="com.example.Project.Action"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter> 
    

    在清单中的活动声明的内部。

        4
  •  5
  •   Oded    14 年前
        5
  •  2
  •   Quintin Robinson    17 年前

    在ActivityManagerServer.java中,存在以下判断。

    int checkComponentPermission(String permission, int pid, int uid, int reqUid)
    // If the target requires a specific UID, always fail for others.
       if (reqUid >= 0 && uid != reqUid) {
           return PackageManager.PERMISSION_DENIED;
       }
    

    确保您只是试图通过任何意图调用公开的活动。