0

LiveWallpapers 拥有 BIND_WALLPAPER 权限,只允许系统绑定到它。我希望在设备启动时将 livewallpaper 服务设置为壁纸。为此,我编写了一个广播接收器,它在启动时使用意图启动壁纸服务。动态壁纸的组件被设置为意图的组件。目前这可以检测到壁纸服务,但由于权限 BIND_WALLPAPER 无法设置它。我的应用程序清单包括以下内容

<receiver android:name=".MyStartupIntentReceiver" android:permission="android.permission.BIND_WALLPAPER">
        <intent-filter>
             <action android:name="android.intent.action.BOOT_COMPLETED" />
             <category android:name="android.intent.category.HOME" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SET_WALLPAPER" />
            <category android:name="android.intent.category.HOME"/>
        </intent-filter>           
    </receiver>

广播接收器如下:

Intent ii = new Intent(Intent.ACTION_MAIN);
    ii.addCategory(Intent.CATEGORY_HOME);

    ii.setComponent(new ComponentName("com.example.android.livecubes","com.example.android.livecubes.cube1.CubeWallpaper1"));
    context.startService(ii);

我也用 action.SET_WALLPAPER...category 尝试了上述操作:启动器/默认,但一切都抛出错误权限被拒绝:需要 bind_wallpaper。此权限存在于服务端和接收端。如何在没有选择器/动态壁纸选择器的情况下在启动时设置动态壁纸?

4

1 回答 1

0

这是不可能的。您可以启动选择器,但不能绕过选择器并以无缝方式实际设置壁纸。在此处查看 Romain Guy 的评论:http ://groups.google.com/group/android-developers/browse_thread/thread/a22e66002f884718

于 2011-05-12T08:35:09.493 回答