开发者

how can a broadcast receiver get the android system to start a livewallpaper service?

LiveWallpapers have the permission BIND_WALLPAPER that allows only the system to bind to it. I want the livewallpaper service to be set as the wallpaper, when the device boots up. For this I have written a broadcast receiver that on boot up is meant to start the wallpaper service, using intents. The component of the livewallpaper is set as the component of the intent. At the moment this can detect the wallpaper service but cannot set it due to the permission BIND_WALLPAPER. The manifest of my application includes as follows

<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>

The broadcast receiver is as follows :

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);

Ive also tried the above with action.SET_WALLPAPER...category : Launcher/default but everything throws the error permission denied: bind_wallpaper needed. This permission is present at both the service and receiver ends. How can I set the livewallpaper on boot up without chooser/livewa开发者_运维知识库llpaper picker ?


This is not possible. You can start the chooser, but you cannot bypass the chooser and actually set the wallpaper in a seamless way. See comment from Romain Guy here: http://groups.google.com/group/android-developers/browse_thread/thread/a22e66002f884718

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜