GIST like Remote ConfigšŖ
Using gist as a remote configuration
--
In this article, we will learn how to use GitHub Gist as a remote storage server (like Firebase Remote Config for Android)
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 š.