获取动态壁纸的包名

public ArrayList<String> getLivePaperPkgName() {
	ArrayList<String> pkgList = new ArrayList<String> ();
	List<ResolveInfo> list = mPackageManager.queryIntentServices(
			new Intent(WallpaperService.SERVICE_INTERFACE),
			PackageManager.GET_META_DATA);
	int listSize = list.size();
	
	for (int i = 0; i < listSize; i++) {
		ResolveInfo resolveInfo = list.get(i);
		ComponentInfo ci = resolveInfo.serviceInfo;
		WallpaperInfo info;
		try {
			info = new WallpaperInfo(mContext, resolveInfo);
		} catch (XmlPullParserException e) {
			Log.w(TAG, "Skipping wallpaper " + ci, e);
			continue;
		} catch (IOException e) {
			Log.w(TAG, "Skipping wallpaper " + ci, e);
			continue;
		}

		String packageName = info.getPackageName();
		
		pkgList.add(packageName);
	}
	return pkgList;
}

你可能感兴趣的:(获取动态壁纸的包名)