androidandroid-manifestandroid-permissionsusagestatsmanager

Permission required to use UsageStatsManager


I'm trying to use UsageStatsManager. I understand that I need to put the following into my Android manifest:

<uses-permission
    android:name="android.permission.PACKAGE_USAGE_STATS"
    tools:ignore="ProtectedPermissions" />

However, Eclipse throws the following error when I try that: The prefix "tools" for attribute "tools:ignore" associated with an element type "uses-permission" is not bound.

How do I declare the permission properly?


Solution

  • In your manifest file, you have to add the tools namespace. You can declare it this way:

    xmlns:tools="http://schemas.android.com/tools"
    

    for example in the manifest tag:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools">
    .
    .
    .
    </manifest>