Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] Bug Report Title - [Android] Unable to Open Push Notification on Android When Tapped #2897

Open
Vijay-Magadum opened this issue Jan 17, 2025 · 4 comments

Comments

@Vijay-Magadum
Copy link

I am developing a chat application using the Expo and GetStream SDK. For notifications, I am integrating Firebase with the GetStream SDK, which allows me to receive notifications. I have also implemented background handlers and events for notifications, which work fine on iOS but are causing issues on Android as described below. The error occurs when I click on a notification while the app is in a killed state.

FATAL EXCEPTION: main
Process: com.mychat.app, PID: 6853
java.lang.RuntimeException: Unable to pause activity {com.mychat.app/com.mychat.app.MainActivity}: java.lang.reflect.InvocationTargetException
    at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5831)
    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5782)
    at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5729)
    at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:54)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:180)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2820)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:328)
    at android.app.ActivityThread.main(ActivityThread.java:9156)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:594)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at expo.modules.ReactActivityDelegateWrapper.invokeDelegateMethod(ReactActivityDelegateWrapper.kt:328)
    at expo.modules.ReactActivityDelegateWrapper.onPause(ReactActivityDelegateWrapper.kt:203)
    at com.facebook.react.ReactActivity.onPause(ReactActivity.java:53)
    at android.app.Activity.performPause(Activity.java:9132)
    at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1657)
    at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5821)
    ... 14 more
Caused by: java.lang.AssertionError
    at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:82)
    at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:597)
    at com.facebook.react.ReactDelegate.onHostPause(ReactDelegate.java:134)
    at com.facebook.react.ReactActivityDelegate.onPause(ReactActivityDelegate.java:134)
    ... 21 more

@santhoshvai
Copy link
Member

Hey @Vijay-Magadum can you paste your package json please so what we can see the versions of all the libraries used for push

@Vijay-Magadum
Copy link
Author

Vijay-Magadum commented Jan 17, 2025

hey @santhoshvai this is my package.json file
{
"name": "mychatapp",
"main": "index.js",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^14.0.0",
"@notifee/react-native": "^9.1.8",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-camera-roll/camera-roll": "^7.8.3",
"@react-native-community/datetimepicker": "8.0.1",
"@react-native-community/netinfo": "11.3.1",
"@react-native-firebase/app": "^20.1.0",
"@react-native-firebase/messaging": "^20.1.0",
"@react-navigation/native": "^6.0.2",
"@stream-io/flat-list-mvcp": "^0.10.3",
"axios": "^1.7.2",
"axios-logger": "^2.8.1",
"expo": "~51.0.39",
"expo-av": "~14.0.7",
"expo-build-properties": "~0.12.5",
"expo-clipboard": "^6.0.3",
"expo-crypto": "~13.0.2",
"expo-device": "~6.0.2",
"expo-document-picker": "^12.0.1",
"expo-file-system": "~17.0.1",
"expo-font": "~12.0.6",
"expo-haptics": "^13.0.1",
"expo-image-manipulator": "~12.0.5",
"expo-image-picker": "~15.0.5",
"expo-linear-gradient": "~13.0.2",
"expo-linking": "~6.3.1",
"expo-media-library": "~16.0.5",
"expo-notifications": "~0.28.19",
"expo-router": "~3.5.24",
"expo-sharing": "^12.0.1",
"expo-splash-screen": "~0.27.7",
"expo-status-bar": "~1.12.1",
"expo-system-ui": "~3.0.4",
"expo-updates": "~0.25.27",
"expo-web-browser": "~13.0.3",
"i18next": "^23.11.5",
"lodash": "^4.17.21",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "^14.1.2",
"react-native": "0.74.5",
"react-native-async-storage-namespace": "^1.0.2",
"react-native-country-picker-modal": "^2.0.0",
"react-native-create-thumbnail": "^2.0.0",
"react-native-fast-image": "^8.6.3",
"react-native-file-viewer": "^2.1.5",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "~2.16.1",
"react-native-localize": "^3.2.0",
"react-native-modal-datetime-picker": "^17.1.0",
"react-native-pager-view": "6.3.0",
"react-native-paper": "^5.12.3",
"react-native-phone-input": "^1.3.7",
"react-native-quick-sqlite": "8.2.2",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.31.1",
"react-native-svg": "15.2.0",
"react-native-tab-view": "^3.5.2",
"react-native-vector-icons": "^10.1.0",
"react-native-web": "~0.19.10",
"stream-chat-expo": "^5.41.2",
"uuid": "^10.0.0",
"expo-dev-client": "~4.0.29"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@types/lodash": "^4.17.7",
"@types/react": "~18.2.45",
"axios-logger": "^2.8.1",
"jest": "^29.2.1",
"jest-expo": "~51.0.4",
"react-test-renderer": "18.2.0",
"stream-chat": "^8.41.0",
"typescript": "~5.3.3"
},
"private": true
}

@santhoshvai
Copy link
Member

Could you update your firebase versions and try out again please

@Vijay-Magadum
Copy link
Author

Hey @santhoshvai , sorry for the delay. I've downloaded the latest package, but the error still persists.

This is how i am displaying notification using notifee:

export async function displayNotifications(
  fromUser: any,
  messageBody: any,
  channelId: any,
  messageId: any
) {
  await notifee.displayNotification({
    title: `${i18n.t("NEW_MESSAGE_PART")} ${fromUser}`,
    body: messageBody,
    data: {
      cid: channelId,
    },
    android: {
      channelId: "chat-messages",
      smallIcon: "ic_launcher",
      importance: AndroidImportance.HIGH,
      pressAction: {
        id: "default",
        launchActivity: "default",
      },
    },
    id: messageId,
  });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants