Skip to content

Notifications.getInitialNotification() and RNN 4.2.1 #828

@claudiozam

Description

@claudiozam

Hi, after the new release 4.2.1 the behavior of the implementation changed.
I notice some issues.

Case 1
Dead state (100% dead)
Click on the notification message
App will open again
Notifications.getInitialNotification() no data

Case 2
Dead state (if I close the app with the android back button)
Click on the notification message
App will open again
Notifications.getInitialNotification() returns data

Case 3
Background state
Click on the notification message
App will open again
Notifications.getInitialNotification() returns data

Case 4
Background state
I have 2 notifications.
Click on the last notification message
App will open again
Notifications.getInitialNotification() returns data but from the first notification

This new version does not use the activity that is in Background?

Enviroment

"react-native": "0.67.3"
"react-native-notifications": "4.2.1"

Tested on android 12 and 11. Emulator and real devices (Samsung S10, S20).
With and without custom PushNotification class ([Layout Customization).

AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />

<application
  android:name=".MainApplication"
  android:label="@string/app_name"
  android:icon="@mipmap/ic_launcher"
  android:roundIcon="@mipmap/ic_launcher_round"
  android:allowBackup="false"
  android:usesCleartextTraffic="true"
  android:requestLegacyExternalStorage="true"
  android:theme="@style/AppTheme">
  <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

  <activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
    android:windowSoftInputMode="adjustResize"
    android:launchMode="singleTask"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
    </intent-filter>
    <intent-filter android:autoVerify="true">
      <action android:name="android.intent.action.VIEW"/>
      <category android:name="android.intent.category.DEFAULT"/>
      <category android:name="android.intent.category.BROWSABLE"/>
      <data android:host="*.xxxxxx.co" android:scheme="https" android:pathPrefix="/m/posts"/>
      <data android:host="*.xxxxxx.co" android:scheme="https" android:pathPrefix="/m/conversations"/>
    </intent-filter>
    

  </activity>

</application>

dependencies

"dependencies": {
"@alessiocancian/react-native-actionsheet": "^3.1.1",
"@codler/react-native-keyboard-aware-scroll-view": "2.0.1",
"@fortawesome/fontawesome-common-types": "file:./local_fortawesome/fontawesome-common-types",
"@fortawesome/fontawesome-svg-core": "file:./local_fortawesome/fontawesome-svg-core",
"@fortawesome/free-brands-svg-icons": "file:./local_fortawesome/free-brands-svg-icons",
"@fortawesome/pro-light-svg-icons": "file:./local_fortawesome/pro-light-svg-icons",
"@fortawesome/pro-regular-svg-icons": "file:./local_fortawesome/pro-regular-svg-icons",
"@fortawesome/pro-solid-svg-icons": "file:./local_fortawesome/pro-solid-svg-icons",
"@fortawesome/react-native-fontawesome": "file:./local_fortawesome/react-native-fontawesome",
"@invertase/react-native-apple-authentication": "^2.1.1",
"@react-native-async-storage/async-storage": "^1.16.1",
"@react-native-clipboard/clipboard": "^1.6.0",
"@react-native-community/art": "^1.2.0",
"@react-native-community/audio-toolkit": "^2.0.3",
"@react-native-community/datetimepicker": "^3.5.2",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/slider": "^4.2.0",
"@react-native-firebase/analytics": "^14.5.0",
"@react-native-firebase/app": "^14.5.0",
"@react-native-google-signin/google-signin": "^7.1.0",
"@react-native-picker/picker": "^2.3.0",
"@react-navigation/drawer": "^6.3.0",
"@react-navigation/elements": "^1.3.1",
"@react-navigation/native": "^6.0.8",
"@react-navigation/stack": "^6.1.1",
"@types/uuid": "^8.3.4",
"axios": "^0.24.0",
"chance": "^1.1.8",
"color": "^3.1.3",
"detox": "^19.4.5",
"formik": "^2.2.6",
"fsevents": "^2.3.2",
"hermes-engine": "^0.9.0",
"immutability-helper": "^3.1.1",
"link-preview-js": "^2.1.13",
"lodash": "^4.17.20",
"native-base": "2.15.2",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",
"pretty-bytes": "^6.0.0",
"randomcolor": "^0.6.2",
"react": "17.0.2",
"react-native": "0.67.3",
"react-native-add-calendar-event": "^4.0.0",
"react-native-autolink": "^4.0.0",
"react-native-base64": "^0.2.1",
"react-native-blob-util": "^0.14.0",
"react-native-calendars": "^1.1278.0",
"react-native-color-palette": "^2.2.0",
"react-native-config": "^1.4.5",
"react-native-device-info": "^8.4.6",
"react-native-document-picker": "^8.0.0",
"react-native-fast-image": "^8.5.4",
"react-native-fbsdk-next": "^7.2.0",
"react-native-ffmpeg": "^0.5.2",
"react-native-file-viewer": "^2.1.5",
"react-native-gesture-handler": "^2.2.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-hide-with-keyboard": "^1.2.1",
"react-native-image-crop-picker": "^0.37.3",
"react-native-image-zoom-viewer": "^3.0.1",
"react-native-inappbrowser-reborn": "^3.5.1",
"react-native-iphone-x-helper": "^1.3.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-loading-spinner-overlay": "^2.0.0",
"react-native-localize": "^2.2.0",
"react-native-masked-text": "^1.13.0",
"react-native-mime-types": "^2.3.0",
"react-native-modal": "^13.0.0",
"react-native-modal-datetime-picker": "^13.0.1",
"react-native-modal-selector": "^2.1.0",
"react-native-notifications": "^4.2.1",
"react-native-orientation-locker": "^1.4.0",
"react-native-permissions": "^3.2.0",
"react-native-progress": "^5.0.0",
"react-native-push-notification-popup": "^1.6.0",
"react-native-rate": "^1.2.4",
"react-native-reanimated": "2.4.1",
"react-native-render-html": "^6.3.0",
"react-native-safe-area-context": "^3.4.0",
"react-native-screens": "^3.12.0",
"react-native-share": "^7.3.6",
"react-native-simple-dialogs": "^1.4.0",
"react-native-simple-toast": "^1.1.3",
"react-native-spinkit": "^1.5.1",
"react-native-splash-screen": "^3.3.0",
"react-native-svg": "^12.1.1",
"react-native-swipe-gestures": "^1.0.5",
"react-native-swiper": "^1.6.0",
"react-native-toast-message": "^2.1.0",
"react-native-vector-icons": "^9.1.0",
"react-native-version": "^4.0.0",
"react-native-video": "^5.2.0",
"react-native-webview": "^11.17.2",
"react-redux": "^7.2.3",
"read-package-json": "^4.0.0",
"redux": "^4.0.5",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"rn-placeholder": "^3.0.3",
"rollbar-react-native": "^0.9.1",
"sanitize-filename": "^1.6.3",
"striptags": "^3.1.1",
"url": "^0.11.0",
"yup": "^0.32.8"
}

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions