GIST like Remote Config🪁

Using gist as a remote configuration

Vladislav Shesternin
2 min readSep 28, 2022

In this article, we will learn how to use GitHub Gist as a remote storage server (like Firebase Remote Config for Android)

Photo by DeepMind on Unsplash

1️⃣We go to github.com and go to Your gists.

2️⃣Create a gist.

3️⃣Fill out the Gist.

Green area you need to enter the name of the gist (usually this is the name of the package of your project).

Red area you need to enter the data that you want to store and then change (usually it is JSON).

5️⃣Create secret gist.

6️⃣Getting data URL.

By pressing raw you should see:

In order for the link to not change when you change the data, you need to delete the line between (raw/……..delete this line……../com.demo.game)

Result:

7️⃣Use (OkHttp, Retrofit, Volley) with this URL to get data.

Example (OkHttp):

object Network {
private const val URL = "https://gist.githubusercontent.com/Vladislav-Shesternin/1f7359282ec5eb3fe40876ae3fa9ed9f/raw/com.demo.game"

private val okHttpClient = OkHttpClient.Builder().build()
private val qistRequest = Request.Builder().url(REMOTE_CONFIG_URL).build()
private val executorService = Executors.newSingleThreadExecutor()

fun getGistJSON() = executorService.submit<String> {
okHttpClient.newCall(qistRequest).execute().body?.string() ?: ""
}[20, TimeUnit.SECONDS].run { JSONObject(this) }

}

PS. Vel_daN: Love what You DO 💚.

--

--