amplify-js: Android app not opening if in a killed state
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React Native
Amplify APIs
Push Notifications
Amplify Categories
Not applicable
Environment information
# Put output below this line
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
Memory: 1.52 GB / 15.71 GB
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.3.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 98.0.4758.102
Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.56)
Internet Explorer: 11.0.19041.1202
npmPackages:
@aws-amplify/pushnotification: ^4.3.8 => 4.3.8
@babel/core: ^7.16.7 => 7.16.7
@babel/runtime: ^7.16.7 => 7.16.7
@react-native-community/push-notification-ios: ^1.10.1 => 1.10.1 (1.0.3)
@types/react: ^17.0.38 => 17.0.38
@types/react-native: ^0.66.11 => 0.66.11
aws-amplify: ^4.3.11 => 4.3.11
axios: ^0.24.0 => 0.24.0 (0.21.4)
babel-plugin-transform-remove-console: ^6.9.4 => 6.9.4
eslint: 8.6.0 => 8.6.0
hermes-inspector-msggen: 1.0.0
metro-react-native-babel-preset: ^0.66.2 => 0.66.2
react: 17.0.2 => 17.0.2
react-native: 0.66.4 => 0.66.4
react-native-cli: ^2.0.1 => 2.0.1
npmGlobalPackages:
@aws-amplify/cli: 7.6.2
npm: 8.3.2
react-devtools: 4.8.2
react-native-cli: 2.0.1
yarn: 1.22.10
Describe the bug
Like if you got a notification and then kill the app, Tapping on the notification wont open it. Did some debugging and found this. In RNPushNotificationHelper, while creating notification , we set pendingIntent PendingIntent pendingIntent = PendingIntent.getBroadcast… Now if we kill the app, the RNPushNotificationBroadcastReceiver also gets killed and so now tapping on notification not finding this.
May be related to (but still happening ) https://github.com/aws-amplify/amplify-js/pull/9055 https://github.com/aws-amplify/amplify-js/issues/6000
Expected behavior
I checked some other libraries like https://github.com/zo0r/react-native-push-notification which uses Service to solve this as Services won’t get killed if app gets killed. I cant use other libraries because amplify is tightly linked to aws pinpoint.
Hope this will help anyone and get better solution.
Reproduction steps
- kill the app
- send push notification
- Open the app
- send push notification again
- kill the app
- Now ope the app from push received in step4 above
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
Any Android Device
Mobile Operating System
Any Android OS
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 27 (10 by maintainers)
@RMG0, the fix should be released early next week if there is no other delay.
I tested latest release 4.3.17 and can confirm like this is fixed. Thank you all for fixing this
@RMG0 the release is complete and the fix is available in the latest version. Please check if it solves it and close the issue if so. Thank you for working with us on this and opening the issue!
Hey @Samaritan1011001 , I tested and can confirm like it works for our case. Thank you so much for fixing this. I was thinking its a huge refactor but not sure if this is a temporary work around or need more changes. Thanks!
@RMG0 and @LeviWilliams Created a PR with a simple fix. Let me know if the solution works on your setup. It still needs to be reviewed and merged.
Thanks @Samaritan1011001 for checking this and really appreciate this.
I can understand the reason behind this issue. Tested with
targetSdkVersionto 25 and this fixes the problem but we can’t usetargetSdkVersion25 on stores because as per their requirementtargetSdkVersionshould be 30. (https://support.google.com/googleplay/android-developer/answer/9859152?visit_id=637402646062706504-1797308153&rd=1#targetsdk)So even if this fixed this problem, no one can use it in production.
This is a big issue for us because we are having a huge user base and we send many push notifications on daily basis based on event and some engagement cases, And most of the time push is failing to open the app failing our push notification purpose.
Please don’t mind but Can I ask any approximate time for this fix? I know you may have other priority stuffs too but just wanted to check so we can set out plan on this.
Again, A huge thank you to you and the team for this awesome module.