fix: handle missing live wallpaper chooser activity - #38
Conversation
When setting the live wallpaper from the home screen: 1. Attempt WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER with the target component. 2. Fall back to WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER if the direct change intent is unavailable. 3. Fall back to Intent.ACTION_SET_WALLPAPER if the live wallpaper chooser is unavailable. 4. Catch ActivityNotFoundException and SecurityException and display a toast notification if no wallpaper chooser activity is available on the device. Co-authored-by: Gemini 3.7 Flash <noreply@google.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Gemini 3.7 Flash <noreply@google.com>
Code reviewResolved by cc36d67. With weatherd/app/src/main/java/xyz/attacktive/weatherd/ui/home/HomeScreen.kt Lines 230 to 253 in cc36d67 No further issues. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Problem
On certain devices (such as Android Go edition devices or stripped OEM ROMs without a live wallpaper preview component), calling
startActivitywithWallpaperManager.ACTION_CHANGE_LIVE_WALLPAPERthrowsandroid.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.service.wallpaper.CHANGE_LIVE_WALLPAPER (has extras) }.Solution
When setting the live wallpaper from the home screen:
WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPERwith the target component.WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSERif the direct change intent is unavailable.Intent.ACTION_SET_WALLPAPERif the live wallpaper chooser is unavailable.ActivityNotFoundExceptionandSecurityExceptionand display a toast notification if no wallpaper chooseractivity is available on the device.