Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live wallpaper not work in some device #170

Closed
SzHzSH opened this issue Jan 17, 2024 · 2 comments
Closed

Live wallpaper not work in some device #170

SzHzSH opened this issue Jan 17, 2024 · 2 comments

Comments

@SzHzSH
Copy link

SzHzSH commented Jan 17, 2024

Cause of the problem

In some device, package name com.android.wallpaper.livepicker is not available including my device. And i try to search the setting to set the app as a live wallpaper and im not found it. So i search the alternative. And i try to build the app with some change.

Finally live wallpaper work

I ask to chatbot how to make a live wallpaper and im found some line of code to make the app work. Im change start with this line on your code. I change it with this code

private boolean startLiveWallpaperPicker(){
    Intent intent2 = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER); 
    intent2.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, 
       new ComponentName(MainActivity.this, ShaderWallpaperService.class));
    return startActivity(this, intent2);
}

But sometime the app crash and i dont know why. May you can improve your app with some change to make it work. Im not expert in android, but i know some. Just in my hobby

@markusfisch
Copy link
Owner

Thanks for filing an issue about this, and for giving a solution right away 👍

I've added this in e1755ec

I believe the reason it might sometimes crash is that startActivity cannot always resolve the Intent. For this reason, I've added a try/catch block for a ActivityNotFoundException and return false if this exception is thrown.

@SzHzSH SzHzSH closed this as completed Jan 18, 2024
@SzHzSH
Copy link
Author

SzHzSH commented Jan 18, 2024

Thanks for filing an issue about this, and for giving a solution right away 👍

I've added this in e1755ec

I believe the reason it might sometimes crash is that startActivity cannot always resolve the Intent. For this reason, I've added a try/catch block for a ActivityNotFoundException and return false if this exception is thrown.

Thanks a lot for fix this bug in my device. Btw my device is vivo v2031 with android 13. The vendor modified the code from the original google android code. So it's the developer's job to align everything 😂. The application is working as expected now and there are no force closes anymore. Thanks again for your good response 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants