I’m working with WallpaperService in my Android project, and when the service starts, it presents options to the user to set the wallpaper either for the home screen or both the home and lock screens. I want to modify this behavior so that only one option is available, specifically setting the wallpaper for both the home and lock screens by default. How can I achieve this?
my code is like
fun setToWallPaper(context: Context) {
val intent = Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER).apply {
putExtra(
WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
ComponentName(context, Mp4WallpaperService::class.java)
)
flags = Intent.FLAG_ACTIVITY_NEW_TASK
}
context.startActivity(intent)
try {
WallpaperManager.getInstance(context).clear()
} catch (e: IOException) {
e.printStackTrace()
}
}
should show only one option home and lock screen
You need to sign in to view this answers