CGS
object CGS
The SDK's entry point: initialize it here, then reach every service from here.
Initialization
init must run once, before anything else — typically from Application.onCreate:
CGS.init(
SdkConfig.Builder(applicationContext)
.environment(CgsEnvironment.PRODUCTION)
.apiKey("YOUR_LICENSE_KEY") // or via the manifest
.productName("YOUR_PRODUCT_NAME")
.build()
)Content copied to clipboard
Calling it a second time is a no-op: the first configuration stands.
License resolution
The license is looked up in this order:
SdkConfig.Builder.apiKey, if you set one
the
co.cafeyn.cgs.license<meta-data>entry in yourAndroidManifest.xml
Neither found means MissingLicenseException. To declare it in the manifest:
<application ... >
<meta-data
android:name="co.cafeyn.cgs.license"
android:value="YOUR_LICENSE_KEY" />
</application>Content copied to clipboard
The services
| auth | Opening a session and choosing the active profile |
| content | Publications, issues, articles, videos, media |
| download | Fetching issues for offline reading |
| readings | How far into each issue the reader got |
| readingList | Issues saved for later |
Each returns the same instance every time, so there is nothing to hold on to:
val publications = CGS.content().publicationsContent copied to clipboard
Reaching for any of them before init throws InitializationException.
Functions
Link copied to clipboard
Whether init has already run.
Link copied to clipboard
The reading-list service: issues the user saved for later.