chat-sdk-android
chat-sdk-android copied to clipboard
'sdk.chat.core.push.BroadcastHandler sdk.chat.core.handlers.PushHandler.getBroadcastHandler()' on a null object reference
When I try to leave a group or join a group from the another device, then my Android App is crashing with the following error.
java.lang.RuntimeException: Unable to start receiver sdk.chat.core.push.DefaultBroadcastReceiver: java.lang.NullPointerException: Attempt to invoke interface method 'sdk.chat.core.push.BroadcastHandler sdk.chat.core.handlers.PushHandler.getBroadcastHandler()' on a null object reference
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3797)
at android.app.ActivityThread.access$1400(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'sdk.chat.core.push.BroadcastHandler sdk.chat.core.handlers.PushHandler.getBroadcastHandler()' on a null object reference
at sdk.chat.core.push.DefaultBroadcastReceiver.onReceive(DefaultBroadcastReceiver.java:17)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3788)
Here is my ChatSDK Initialization code.
private fun initChatSDK() {
try {
ChatSDK.builder().apply {
anonymousLoginEnabled = false
remoteConfigEnabled = false
sendSystemMessageWhenRoleChanges = false
showLocalNotifications = false
disablePresence = false
}
.build()
.addModule(
FirebaseModule.builder()
.setFirebaseRootPath("dev")
.setEnableCompatibilityWithV4(true)
.setDisablePublicThreads(true)
.build()
)
.setInterfaceAdapter(BaseInterfaceAdapter::class.java)
.build()
.activate(this)
} catch (e: Exception) {
e.printStackTrace()
}
}
@bensmiley Any idea how to avoid this ?
Hi @ourdex86 where are you calling initChatSDK from? Can you tell me which class / method?
@bensmiley .. I am invoking this from Application class