开发者

Can a live wallpaper be linked to an app?

开发者 https://www.devze.com 2023-03-10 17:07 出处:网络
i\'m new at live wallpapers. Is it possible开发者_JAVA百科 to link a live wallpaper to an app with it\'s own engine? I mean, to avoid using the typical \"Live wallpapers settings\" where you choose th

i'm new at live wallpapers. Is it possible开发者_JAVA百科 to link a live wallpaper to an app with it's own engine? I mean, to avoid using the typical "Live wallpapers settings" where you choose the amount of items (mostly fishes xD), that you want in the wallpaper. I'd like to have my own app to manage the content of the live wallpaper. Would that be possible? If answer is yes, i'd be helpful if you told me how to do it.


I don't think Hackbod understood your question. If you want to place your live wallpaper settings in an app instead of in the preferences button on live wallpaper preview, you can do that.

First, you must set your application to be a live wallpaper and a regular application at same time. So your manifest should have these two parts:

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

and

<service android:name="..." android:permission="android.permission.BIND_WALLPAPER">
    <intent-filter android:priority="1">
        <action android:name="android.service.wallpaper.WallpaperService" />
    </intent-filter>
    ....
</service>

Second you should persist user settings changes made in your app (you can use SharedPreferences) and update your live wallpaper behavior on your WallpaperService.Engine callbacks (like onVisibilityChanged or whatever makes sense for you).


Sorry, the live wallpaper is global to the system and can't change per-application.

0

精彩评论

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