Android Permission Denial starting Intent for Wallpaper Settings

一笑奈何 提交于 2019-12-24 15:03:22

问题


Unfortunately when I try to run my wallpaper I get an error message saying Permission Denial starting Intent and requires android.permission.BIND_WALLPAPER but I can't seem to figure out why. My manifest looks like the following:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.package">

    <uses-feature android:name="android.software.live_wallpaper" />
    <uses-permission android:name="android.permission.SET_WALLPAPER" />

    <application
        android:exported="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:permission="android.permission.BIND_WALLPAPER">

        <service
            android:name="WallpaperService"
            android:icon="@drawable/icon"
            android:label="@string/app_name"
            android:permission="android.permission.BIND_WALLPAPER">

            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>
            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/livewallpaper" />

        </service>
        <activity
            android:name=".WallpaperSetClass"
            android:exported="true"
            android:permission="android.permission.BIND_WALLPAPER"
            android:label="@string/app_name">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

The live wallpaper does run perfectly if I set it through the live wallpaper part of my phone, but I would like to have a settings area as well to be able to open in which I can't. At the moment my settings class is basically empty containing just an onCreate function and a layout with a button.

Is there something I'm missing? I seem to have the permissions along with android:exported


回答1:


Turns out I had

android:permission="android.permission.BIND_WALLPAPER"

In the wrong spot, it should be in the service tag, and only have ONE, having multiple will break it.



来源:https://stackoverflow.com/questions/33314266/android-permission-denial-starting-intent-for-wallpaper-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!