问题描述
我想创建自己的LiveWallpaperPhaperPrapiew,即向用户显示所选动态壁纸的全屏预览(没有"Set Wallpaper"和"设置"按钮)库存操作系统预览所具有).
从2.1重建LivePicker-class(http://android.git.kernel.org/?p=platform/packages/wallpapers/livepicker.git; = rere ;;f=src/com/Android/壁纸/LivePicker; H = 1557E0AE77AA8B0F8191472A204B5A7B4ADD31A4; HB = Master"rel ="nofollow noreferrer"nofollow noreferrer"android.git.kernel.org )工作很大,所以我能让用户选择一个壁纸预览,但实际的LiveWallPaperPrappiew-class尝试导入以下私有接口/类:
import android.service.wallpaper.IWallpaperConnection;
import android.service.wallpaper.IWallpaperService;
import android.service.wallpaper.IWallpaperEngine;
import android.service.wallpaper.WallpaperSettingsActivity;
是有没有办法在我的应用程序中显示LiveWallpaper而不诉诸使用私人API(我显然不想做)?
谢谢!
nick
推荐答案
你不能这样做.动态壁纸选择器是Android操作系统的一部分,无法更换.
其他推荐答案
调查同样的问题,但也击中了一端.
我的想法是我不需要访问iwallpaperconnection等,但我可以在绑定服务上使用反射.
但是,我得到了 Warn/ActivityManager(96):权限拒绝:访问服务ComponentInfo {com.android.wallpaper/com.android.wallpaper.grass.grasswallpaper.grass.grasswallpaper}从pid = 4196,Uid = 10070需要android.permission.bind_wallpaper查看壁纸所需的权限android.permission.bind_wallpaper,它是普通应用程序无法使用的系统许可.
编辑: 创建一个名为当前壁纸的应用,可在市场上提供 https://market.android.com/details?id=com.elsewhat .android.currentwallpaper
它基本上显示了独立应用中的当前壁纸,并允许您通过标准壁纸选择器的意图更改壁纸.
应用程序使用主题android:theme ="@ android:style/theme.wallpaper.notitlebar.fullscreen"
问题描述
I would like to create my own LiveWallpaperPreview, i.e. to show the user a fullscreen preview of what the selected Live Wallpaper looks like (without the "Set Wallpaper" and "Settings" button that the stock-OS preview has).
Rebuilding the LivePicker-Class from 2.1 (android.git.kernel.org) works great, so I am able to let the user select a wallpaper to be previewed, but the actual LiveWallpaperPreview-Class tries to import the following private Interfaces/Classes:
import android.service.wallpaper.IWallpaperConnection;
import android.service.wallpaper.IWallpaperService;
import android.service.wallpaper.IWallpaperEngine;
import android.service.wallpaper.WallpaperSettingsActivity;
Is there any way to display a LiveWallpaper in my app without resorting to using the private APIs (which I obviously don't want to do)?
Thanks!
Nick
推荐答案
You cannot do this. The live wallpaper picker is part of the Android operating system and cannot be replaced.
其他推荐答案
Looking into the same problem, but also hit a dead end.
My idea was that I didn't need access to IWallpaperConnection etc., but that I could use reflection on the bound service.
However, I get WARN/ActivityManager(96): Permission Denial: Accessing service ComponentInfo{com.android.wallpaper/com.android.wallpaper.grass.GrassWallpaper} from pid=4196, uid=10070 requires android.permission.BIND_WALLPAPER
The permission android.permission.BIND_WALLPAPER is required for viewing the wallpaper and it is a system permission not available to normal apps.
EDIT: Created an app called Current Wallpaper that is available on the market https://market.android.com/details?id=com.elsewhat.android.currentwallpaper
It basically displays the current wallpaper in a standalone app and allows you to change the wallpaper through an intent to the standard wallpaper picker.
The app uses the theme android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"