Skip to content

Setting up the config json

Sarsa Murmu edited this page May 13, 2023 · 2 revisions

What is Config JSON

You can use Config JSON to control some parts of your dashboard remotely. Note that you have to store your Config JSON in cloud, like you do for wallpaper's JSON.

There are two parts of Config JSON. The parts are - App Updater and Disable Request.

App Updater

App Updater is used to check if an update is available for your app. You have to configure it manually.

First enable check for update button.

  • Open app/src/main/res/values/dashboard_configuration.xml
  • Search for this line
    <bool name="enable_check_update">false</bool>
  • Set its value to true
    <bool name="enable_check_update">true</bool>

Now create a JSON file. We will edit the JSON file.

The properties required in JSON to support App Updater -

{
  "latestVersion": "1.1",
  "latestVersionCode": 1,
  "url": "https://github.com/zixpo/candybar",
  "releaseNotes": [
    "This is the text which will be shown on update changelog",
    "Another release note",
    "You can use <b>text</b> <i>formatting</i> <u>here</u>"
  ]
}

In the above JSON -

  • latestVersion is the name of your latest version, you can think of it like versionName of your app's build.gradle.
  • latestVersionCode is latest version's code which is available for your app, you can think of it like versionCode of build.gradle.
  • url is the URL which will be opened when your users tap the "Update" button.
  • releaseNotes will be shown in the update's changelog.

Remember to update your Config JSON's latestVersionCode with your app's versionCode when updating your app.

Disable Request

You can even disable icon request remotely using Config JSON. Sometimes you update your app and many people (who did not update the app), use the old version of your icon pack and they make icon requests. It's possible that you have already added those requested icons but the same icons get requested again because the users are using an old version of your icon pack. To prevent this, you can use the Config JSON. Let's see how to set this up.

First enable check for json before requesting icons

  • Open app/src/main/res/values/dashboard_configuration.xml.
  • Search for this line
    <bool name="json_check_before_request">false/bool>
  • Set its value to true
    <bool name="json_check_before_request">true</bool>

In Config JSON these are the properties required for enabling disable request -

{
  "url": "https://github.com/zixpo/candybar",
  "disableRequest": {
    "below": 10,
    "on": "40 20 353"
  }
}

In Above JSON -

  • url is a string of URL which will be opened when users tap "Update" Button.
  • disableRequest is a JSON Object which contains two properties
    • below is a number. If an user's app's versionCode is lower than the fields value, the user will not be able to make icon requests.
    • on is a string of versionCode numbers in which the icon request will be blocked. Separate the version codes using space or comma ,. Ex: if you want to disable icon request in app with version codes 10, 23, 75 you will set on's value to either "10,23,75" or "10 23 75".

Combining JSON or Using Both JSON

You can use both features, just combine those JSONs, Like this -

{
  "latestVersion": "1.1",
  "latestVersionCode": 1,
  "disableRequest": {
    "below": 10,
    "on": "40 20 353"
  },
  "url": "https://github.com/zixpo/candybar",
  "releaseNotes": [
    "This is the text which will be shown on Update",
    "Another Release Note"
    "You can Use <b>Text</b> <i>Formatting</i> <u>Too</u>"
  ]
}

Now save this JSON and upload it to any hosting service (like GitHub). Then retrieve the raw link of the JSON file and add it to dashboard_configuration.xml. To do that -

  • Open app/src/main/res/values/dashboard_configuration.xml
  • Search for this line
    <string name="config_json"></string>
  • Set its value to the JSON's link
<string name="config_json">https://yourwebsite.com/link/to/config.json</string>

Now App Updater and Disable Request will work on your app

Clone this wiki locally