Table of Contents

  1. The Cloud
  2. URL Configuration
  3. Downloading
  4. JSON File


The Cloud

Polar uses cloud-based wallpapers, meaning you need to host your wallpaper images in the cloud. An easy and cheap (free) way to do this is a public GitHub repository. GitHub obviously allows you to host files of any type, and it's fast.


URL Configuration

In /res/values/dev_customization.xml there is a string resource called wallpapers_json_url which needs to be configured with your hosted JSON file (discussed below).

<!-- URL to JSON file containing a map of wallpapers, leave empty to disable wallpapers. -->
<string name="wallpapers_json_url" formatted="false">
    https://raw.githubusercontent.com/afollestad/polar_json/master/wallpapers.json
</string>

Downloading

Below the wallpapers_json_url string mentioned in the section above, there is a boolean named wallpapers_allow_download. This value is set to true by default, in which case users are allowed to download your wallpapers to their device and share them externally. Otherwise, download options are hidden.

<!-- When false, the Save button for wallpapers is hidden. -->
<bool name="wallpapers_allow_download">true</bool>

JSON File

The URL configured above needs to point to a JSON file. This JSON file should look like the one in the image below. It contains an array of wallpaper objects, each containing the author of the wallpaper, the URL to the wallpaper PNG, and the name of the wallpaper. The thumbnail field is optional; the thumbnail URL is used from the wallpapers grid if included, while the url field is always used from the wallpaper viewer.

{
  "wallpapers": [
    {
      "author": "Tom Wellington",
      "url": "https://raw.githubusercontent.com/afollestad/polar_json/master/east_branch.jpg",
      "name": "East Branch",
      "thumbnail": "https://raw.githubusercontent.com/afollestad/polar_json/master/east_branch_thumb.jpg"
    },
    {
      "author": "Tom Wellington",
      "url": "https://github.com/afollestad/polar_json/raw/master/buildings.jpg",
      "name": "Heads Up",
      "thumbnail": "https://github.com/afollestad/polar_json/raw/master/buildings_thumb.jpg"
    },
    {
      "author": "Tom Wellington",
      "url": "https://github.com/afollestad/polar_json/raw/master/flamingos.jpg",
      "name":" Flamingos",
      "thumbnail": "https://github.com/afollestad/polar_json/raw/master/flamingos_thumb.jpg"
    }
  ]
}