tinycreative / react-native-intercom

React Native wrapper for Intercom.io
MIT License
406 stars 280 forks source link

[Android] Issue to combine react-native-firebase and react-native-intercom #412

Closed atrofimenko closed 2 years ago

atrofimenko commented 3 years ago

Hello! i have an issue on android, i can't force to work these packages together. I faced with an issue, that notifications don't work in closed state. I can found some topics, that you need to create only one service in androidmanifest for all of them, create a subclass RNPushNotificationListenerService, and wright your logic there, but as i understand, all these topics connected with react-native firebase 5th version, in my current version "@react-native-firebase/messaging": "^10.1.1", "react-native-intercom": "^18.0.0", these services described in androidmanifest of a package and it uses service and receiver for this and another classes. May be someone already faced with this problem and can share his result?

There is logs from logcat, which told me that there is a problem with a priority of a received push: 12-09 21:47:22.037 system_server 562 2178 W ActivityManager Background start not allowed: service Intent { cmp=com.zirtue.app/io.invertase.firebase.messaging.ReactNativeFirebaseMessagingHeadlessService (has extras) } to com.zirtue.app/io.invertase.firebase.messaging.ReactNativeFirebaseMessagingHeadlessService from pid=20143 uid=10157 pkg=com.zirtue.app startFg?=false
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver Background messages only work if the message priority is set to 'high' 12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.zirtue.app/io.invertase.firebase.messaging.ReactNativeFirebaseMessagingHeadlessService (has extras) }: app is in background uid UidRecord{595f3a9 u0a157 RCVR idle change:idle|uncached procs:1 seq(0,0,0)} 12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1715)
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.app.ContextImpl.startService(ContextImpl.java:1670)
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.content.ContextWrapper.startService(ContextWrapper.java:720) 12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.content.ContextWrapper.startService(ContextWrapper.java:720) 12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at io.invertase.firebase.messaging.ReactNativeFirebaseMessagingReceiver.onReceive(ReactNativeFirebaseMessagingReceiver.java:54) 12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.app.ActivityThread.handleReceiver(ActivityThread.java:3931)
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.app.ActivityThread.access$1400(ActivityThread.java:233)
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1907) 12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.os.Handler.dispatchMessage(Handler.java:106) 12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.os.Looper.loop(Looper.java:223)
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at android.app.ActivityThread.main(ActivityThread.java:7523)
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at java.lang.reflect.Method.invoke(Native Method)
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
12-09 21:47:22.041 zygote 20143 - E RNFirebaseMsgReceiver at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)

kuznetsov-online commented 3 years ago

@atrofimenko any news?