-
Notifications
You must be signed in to change notification settings - Fork 0
Initialise library with application class
Devrath edited this page Dec 18, 2023
·
4 revisions
ππππ-π· -> π³πππππ π πππππππ’ πππππππππ£ππ πππππ ππ πππ πππππππ’
object SDKConfig {
// Context
private lateinit var context: Context
/** ******************** Context ******************** **/
fun initContext(context: Context) { SDKConfig.context = context }
fun getContext(): Context {
if (!SDKConfig::context.isInitialized) {
throw UninitializedPropertyAccessException("Util library is not initialized")
}
return context
}
/** ******************** Context ******************** **/
}ππππ-πΈ -> π°ππ πππ πππππππ’ ππππππππππ’ ππ πππ π°ππππππππππ
implementation(project(":lib-utils"))
ππππ-πΉ -> πΈππππππππ£π πππ πππππππ’ ππππ πππ πππππππππππ πππππ
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// Initialize the SDK here
SDKConfig.initContext(this)
}
}