# Wallpaper APIs

### Overview

The Smart Launcher Wallpaper API is an experimental Android library that lets third‑party apps notify Smart Launcher about the wallpaper a user has selected. It handles temporary file storage, permission management, and metadata sharing so you can integrate without additional manifest setup or custom providers.

### Benefits for Developers

* **Advanced visual effect** – Smart Launcher will be able to apply dynamic blur effects and other enhancements to the wallpapers you supply, ensuring the launcher showcases your content at its best.

| Before                                                                                                                                                                                                                                                                                                        | After                                                                                                                                                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p></p><div><figure><img src="https://2951925047-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbhTQpvrCNT3tTFB_3o%2Fuploads%2FcQbfsTIzNlF3wcSbZvdt%2Fimage.png?alt=media&#x26;token=645dee16-c193-47d4-9061-ec65afa19ff5" alt="" width="279"><figcaption></figcaption></figure></div> | <div><figure><img src="https://2951925047-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbhTQpvrCNT3tTFB_3o%2Fuploads%2FqX0SprdCSVW60R8Oci7Y%2Fimage.png?alt=media&#x26;token=66356262-5c96-42f5-b9ac-2d0d500d7813" alt="" width="279"><figcaption></figcaption></figure></div> |

* **Built‑in attribution** – When users share their setups, Smart Launcher preserves your metadata (author, source, link) so you receive proper credit. This attribution flows through to social posts, helping your work reach new audiences.

| Before                                                                                                                                                                                                                                                                                                 | After                                                                                                                                                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <div><figure><img src="https://2951925047-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbhTQpvrCNT3tTFB_3o%2Fuploads%2FEj8nb4cyMgmYHVCK4lrk%2Fimage.png?alt=media&#x26;token=710228c3-ba83-45d5-8e2b-75de5010e6b2" alt="" width="279"><figcaption></figcaption></figure></div> | <div><figure><img src="https://2951925047-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LbhTQpvrCNT3tTFB_3o%2Fuploads%2Fse6kfoaY6imBxi1bXQF5%2Fimage.png?alt=media&#x26;token=85065715-5ea4-48e9-889f-982b0daac284" alt="" width="279"><figcaption></figcaption></figure></div> |

### Quick Implementation Guide

{% stepper %}
{% step %}
**Add the dependency**

```kotlin
dependencies {
    implementation("net.smartlauncher:wallpaper-api:0.0.4")
}
```

{% endstep %}

{% step %}
**Go to the code that you use to apply your wallpapers**

Before setting the code via WallpaperManager, call `SmartLauncherWallpaperApi.saveWallpaper`

```kotlin

if(/* do not run if you are only changing the lockscreen wallpaper */){
    val result = SmartLauncherWallpaperApi.saveWallpaper(
        context = context,
        bitmap = wallpaperBitmap, // also Uri is supported
        metadata = SmartLauncherWallpaperApi.Metadata(
            author = "Jane Doe",
            link = "https://example.com/wallpaper/42",
            source = "Example App"
        )
    )
    // Useful for debugging
    Log.d(TAG, "SmartLauncherWallpaperAPI returned $result")
}

// IMPORTANT! Wait for SmartLauncherWallpaperApi.saveWallpaper to return, 
// before setting the wallpaper.
WallpaperManager.getInstance(this).setBitmap(bitmap)
```

{% endstep %}

{% step %}
**You are done!**
{% endstep %}
{% endstepper %}

### Recommendations and common errors

✅  Run the code in the background. You should already be doing this for `WallpaperManager.setBitmap`, so ideally both should run on the same background thread.

❌  **Do not change the wallpaper before calling** `SmartLauncherWallpaperApi.saveWallpaper`. Otherwise, Smart Launcher will associate your information with the wrong wallpaper, causing unwanted results.

❌  If you are applying your wallpaper only to the lock screen, **do not call** `saveWallpaper`. Otherwise, your information will again be associated with the wrong wallpaper.

### **How to test it**

1. Verify you are running Smart Launcher 6.5.38 or higher
2. Launch your code, ensure **`SmartLauncherWallpaperApi.saveWallpaper` returns `Success`**&#x20;
3. From Smart Launcher, open preferences, then select **Show your home screen**.

✅ If you see your current setup, the integration is working!  Now, if you populated the metadata field, you should see them as part of the body text when you press the **Share** button.

🚨 If you get an error after selecting **Show your home screen**, something is wrong. Contact us for assistance.

### Experimental Status

This library is still **experimental**. APIs and behavior may change, and backward compatibility is not guaranteed yet. We welcome feedback and issue reports to help stabilize the interface.

***

### Library release notes

**0.0.4**

The library now uses WebP under the hood for improved performance

**0.0.3**

Initial public release


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.smartlauncher.net/work-with-smart-launcher/wallpaper-apis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
