Вопрос

About the app - I am a making my app background a blurred wallpaper. It is easy to get wallpaper as drawable using getWallpaper() method in an Activity. I then convert drawable to bitmap and use a blur algorithm to blur the bitmap and then set it as a background image. This whole process takes some time around 1 to 5 seconds. So I decided to put the blurred wallpaper in SD card so I need to just get that image from sd card then it will not take so much time. So every time user change the wallpaper I need to make that wallpaper blurred and save it to SD card. For that I need ACTION_WALLPAPER_CHANGED broadcast receiver.

Problem - ACTION_WALLPAPER_CHANGED intent filter works fine before API 16 but from API 16 it is deprecated and does not broadcast wallpaper changed action.

I want that whenever user change the background I need my app background changed to that blurred image of the wallpaper.

Это было полезно?

Решение

Since you wont get the broadcast anymore, wouldn't be the best direction for you to try and improve performance on your blurring method, and do it on-the-fly without SD card storage?

The thing is, for the user to change the background, they pretty much have to leave your app (and that you can still notice), and getting down to at most say a second for the blurring when they re-enter your app should still be ok-ish user experience.

Maybe have a look here (if you haven't already), regarding fast image blur on android:

Fast Bitmap Blur For Android SDK

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top