openhab-android: Notifications related crash in full flavor

Fatal Exception: java.lang.RuntimeException: Unable to instantiate service org.openhab.habdroid.core.FcmMessageListenerService: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:3745)
       at android.app.ActivityThread.access$1400(ActivityThread.java:238)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1803)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7073)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
       at android.content.ContextWrapper.getSystemService(ContextWrapper.java:741)
       at org.openhab.habdroid.core.NotificationHelper.<init>(NotificationHelper.kt:41)
       at org.openhab.habdroid.core.FcmMessageListenerService.<init>(FcmMessageListenerService.kt:23)
       at java.lang.Class.newInstance(Class.java)
       at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:103)
       at androidx.core.app.CoreComponentFactory.instantiateService(CoreComponentFactory.java:75)
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:3740)
       at android.app.ActivityThread.access$1400(ActivityThread.java:238)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1803)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7073)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

Environment data

Client

  • Android version: Multiple
  • Device model: Multiple
  • App version : 2.13.1-beta
  • Build flavor : Full
  • Device language: Multiple

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 22 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I’m not sure if this is the same issue, but I noticed with the new release that notifications are no longer working in the beta app. The notifications are sent by myopenhab and show up in the app, but there’s nothing in the Android notification bar. I installed and tested the public release and notifications still work in that version.