Search code examples
androidandroid-wifiandroid-permissions

Android permission not granted


I've created my own android.jar so I can use the hidden API call 'DisplayManager.connectWifiDisplay()'.

When I run the app and call the method, after connecting to a display via Wifi Direct,

I get the following exception:

java.lang.SecurityException: Permission required to connect to a wifi display: Neither user 10105 nor current process has android.permission.CONFIGURE_WIFI_DISPLAY. at android.os.Parcel.readException(Parcel.java:1546) at android.os.Parcel.readException(Parcel.java:1499) at android.hardware.display.IDisplayManager$Stub$Proxy.connectWifiDisplay(IDisplayManager.java:344) at android.hardware.display.DisplayManagerGlobal.connectWifiDisplay(DisplayManagerGlobal.java:309) at android.hardware.display.DisplayManager.connectWifiDisplay(DisplayManager.java:404)

However, I have included the CONFIGURE_WIFI_DISPLAY and CONTROL_WIFI_DISPLAY permissions in my AndroidManifest. Any hints on what I could be missing here?

EDIT: I'm using Android L.


Solution

  • Both of those permissions have a signature protection level (at least on Android 6.0 -- you will need to research if that protection level has changed over the years).

    Hence, unless your app is signed by the platform signing key, you cannot hold those permissions, despite having them in your manifest.