Closed sherrychhabra51 closed 2 years ago
Should be related to https://github.com/aws-amplify/aws-sdk-android/issues/1193
This issue occurs when an upload/download tasks gets initiated while the App is entering background state. This issue is caused by the lack of background upload/download support of amplify-android https://github.com/aws-amplify/amplify-android/issues/1115
Unfortunately this feature request hasn't been fulfilled.
However, amplify-android should make a change to prevent the crash.
@HuiSF Do we have a quick fix in the meantime to get rid of this exception ?
@sherrychhabra51 We have a PR out to address this issue.
If you cannot wait for the next release then I suggest starting the transferservice before calling any amplify storage API, in which case startService call will be ignored the OS since service is already running and you can avoid the crash.
@sherrychhabra51 We have a PR out to address this issue.
If you cannot wait for the next release then I suggest starting the transferservice before calling any amplify storage API, in which case startService call will be ignored the OS since service is already running and you can avoid the crash.
How do I startService in Flutter?
@sdhuka will the next version fix this issue for android and flutter? Or the solution is only for flutter android but not for native android? We are having lots of this issue in our production android app which causing crash reporting flood.
Hi @androidcodehunter the fix implemented in android is only for preventing the crash. Background upload/download is not supported. We will try to integrate the fix in amplify-android as soon as possible (currently we have an issue exists in amplify-android that breaks an amplify-flutter use cae) and roll out a new version of amplify-flutter to release this fix for amplify-flutter consumers.
@sdhuka @HuiSF If possible, can you please let us know when can we expect this to be roll out. This would help us in planning alternatives for the same.
Description
We are currently experiencing lot of crashes while uploading a file when app is in background. Here is the exception that we are gettting:-
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: StorageException(message: Issue uploading file., recoverySuggestion: See included exception for more details and suggestions to fix., underlyingException: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.bedwal.bijak.mvp/com.amazonaws.mobileconnectors.s3.transferutility.TransferService }: app is in background uid UidRecord{d914089 u0a388 LAST bg:+1m37s34ms idle change:cached procs:1 seq(0,0,0)}). Error thrown null
Here is the version that we are using . amplify_storage_s3 0.4.5
We have received this exception plenty of times in last 1 week and the affected devices have OS 8 and above.
Categories
Steps to Reproduce
No response
Screenshots
No response
Platforms
Android Device/Emulator API Level
API 26, API 27, API 28, API 29, API 30, API 31, API 32+
Environment
Dependencies
Device
Xiomi, Samsung, Vivo
OS
Android 8,10,11
CLI Version
6.3.1
Additional Context
No response