在Android上获取动态壁纸的图像/屏幕截图?

时间:2019-08-02 21:39:52

标签: android wallpaper live-wallpaper wallpapermanager

是否有一种使用WallpaperManager API来获取当前动态壁纸的图像的方法?我尝试了以下代码,但只返回了用于设置墙纸的应用程序的图标。

  PackageManager pm = getApplicationContext().getPackageManager();

    // Check if user has set a live wallpaper
    if (WallpaperManager.getInstance(this).getWallpaperInfo() != null) {
        Drawable wallpaperDrawable = WallpaperManager.getInstance(this).getWallpaperInfo().loadThumbnail(pm);
    }

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用 MediaProjection API 来实现这一目标。我建议看下面的代码。有关API的更多信息,请参见this

$xml = simplexml_load_string($content) or die("Error: Cannot create object");

foreach ($xml->children() as $item) {
    echo $item->item->title, ",";
    echo $item->item->description, ",";
    echo $item->item->link, ",";
    echo $item->item->pubDate, ",";
    echo $item->item->author, ",";    
}