Skip to content

Instantly share code, notes, and snippets.

@wajahatkarim3
Last active January 31, 2021 17:17
Show Gist options
  • Save wajahatkarim3/d42366e762cf582b010d02bde311e5e1 to your computer and use it in GitHub Desktop.
Save wajahatkarim3/d42366e762cf582b010d02bde311e5e1 to your computer and use it in GitHub Desktop.
The ZocDoc App class
class ZocdocApp : Application() {
override fun onCreate() {
super.onCreate()
initEmoji()
initCometChat()
}
fun initCometChat() {
val appID = getString(R.string.app_id) // Replace with your App ID
val region = getString(R.string.region) // Replace with your App Region ("eu" or "us")
val appSettings: AppSettings = AppSettings.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(
region
).build()
CometChat.init(this, appID, appSettings, object : CometChat.CallbackListener<String?>() {
override fun onSuccess(successMessage: String?) {
Log.d("ZocdocApp", "Initialization completed successfully")
}
override fun onError(e: CometChatException) {
Log.d("ZocdocApp", "Initialization failed with exception: " + e.localizedMessage)
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment