I am trying to call FileTransferManager.init right before a user uploads a file. That means it can be called multiple times during an app session if the user uploads multiple files or leaves and returns to the upload page. If it is initialized a second time, the callback is never called.
Here is the Android Studio log output from 2 file upload attempts. The first attempt 'cb85e069-9c20-46db-ad26-426d4eee20d8' logs the console output that is in the callback. The second attempt doesn't log any console output from the callback. Both attempts are from the same app session.
2023-10-05 17:26:04.176 11678-11678 ViewRootIm...nActivity] com.appname I ViewPostIme pointer 0
2023-10-05 17:26:04.248 11678-11678 ViewRootIm...nActivity] com.appname I ViewPostIme pointer 1
2023-10-05 17:26:04.263 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172604: videos.html: uploadEventVideo(): starting video file upload
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:04.290 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172604: videos.html: prepareUpload(): background transfer payload {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","filePath":"file:///sdcard/.transforms/synthetic/picker/0/com.android.providers.media.photopicker/media/1000006860.mp4","fileKey":"file","serverUrl":"https://example.net/dev/send_backgroundFile.php","notificationTitle":"Uploading videos","headers":{},"parameters":{}}
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:04.296 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172604: videos.html: prepareUpload(): background transfer init start
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:04.298 11678-11868 PluginManager com.appname D getPlugin - put: FileTransferBackground
2023-10-05 17:26:04.330 11678-11898 CordovaBackgroundUpload com.appname D startUpload: Starting worker via work manager
2023-10-05 17:26:04.334 11678-11898 CordovaBackgroundUpload com.appname D eventLabel=Uploader starting uploads via worker0
2023-10-05 17:26:04.379 11678-11969 Compatibil...geReporter com.appname D Compat change id reported: 194532703; UID 10686; state: ENABLED
2023-10-05 17:26:04.391 11678-11969 ConnectivityManager com.appname D StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4322)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:4886)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4853)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4827)] [androidx.work.impl.utils.NetworkApi24.registerDefaultNetworkCallbackCompat(NetworkApi24.kt:28)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.startTracking(NetworkStateTracker.kt:139)] [androidx.work.impl.constraints.trackers.ConstraintTracker.addListener(ConstraintTracker.kt:57)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.kt:82)] [androidx.work.impl.constraints.WorkConstraintsTrackerImpl.replace(WorkConstraintsTracker.kt:92)] [androidx.work.impl.background.greedy.GreedyScheduler.schedule(GreedyScheduler.java:170)] [androidx.work.impl.Schedulers.schedule(Schedulers.java:119)] [androidx.work.impl.utils.EnqueueRunnable.scheduleWorkInBackground(EnqueueRunnable.java:135)] [androidx.work.impl.utils.EnqueueRunnable.run(EnqueueRunnable.java:95)] [androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)] [java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)] [java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)] [java.lang.Thread.run(Thread.java:1012)]
2023-10-05 17:26:04.399 11678-11678 CordovaBackgroundUpload com.appname D Task succeeded: 3b97eb53-1770-465f-8a3e-ff5ded6186bb
2023-10-05 17:26:04.399 11678-11678 CordovaBackgroundUpload com.appname D eventLabel='Uploader failed inexplicably' error='Data {}'
2023-10-05 17:26:04.425 11678-11678 CordovaBackgroundUpload com.appname D Task succeeded: ef43bd1e-38e5-4033-a214-0ff3526ae74d
2023-10-05 17:26:04.425 11678-11678 CordovaBackgroundUpload com.appname D eventLabel='Uploader failed inexplicably' error='Data {}'
2023-10-05 17:26:04.449 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:04.457 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:04.467 11678-11972 TrafficStats com.appname D tagSocket(264) with statsTag=0xffffffff, statsUid=-1
2023-10-05 17:26:04.704 11678-11972 CordovaBackgroundUpload com.appname I handleProgress: ef43bd1e-38e5-4033-a214-0ff3526ae74d Progress: 0
2023-10-05 17:26:04.705 11678-11972 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : cb85e069-9c20-46db-ad26-426d4eee20d8, progress_percent : 0, }
2023-10-05 17:26:04.705 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:04.708 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:04.723 11678-11678 CordovaBackgroundUpload com.appname D initManager: ef43bd1e-38e5-4033-a214-0ff3526ae74d (RUNNING) Progress: 0
2023-10-05 17:26:04.725 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADING","progress":0}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:04.725 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172604: videos.html: prepareUpload(): video uploader - cb85e069-9c20-46db-ad26-426d4eee20d8 progress: 0%
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:05.064 11678-11972 CordovaBackgroundUpload com.appname I handleProgress: ef43bd1e-38e5-4033-a214-0ff3526ae74d Progress: 1
2023-10-05 17:26:05.064 11678-11972 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : cb85e069-9c20-46db-ad26-426d4eee20d8, progress_percent : 1, }
2023-10-05 17:26:05.064 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:05.068 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:05.084 11678-11678 CordovaBackgroundUpload com.appname D initManager: ef43bd1e-38e5-4033-a214-0ff3526ae74d (RUNNING) Progress: 1
2023-10-05 17:26:05.088 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADING","progress":1}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:05.089 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172605: videos.html: prepareUpload(): video uploader - cb85e069-9c20-46db-ad26-426d4eee20d8 progress: 1%
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:06.206 11678-11972 CordovaBackgroundUpload com.appname I handleProgress: ef43bd1e-38e5-4033-a214-0ff3526ae74d Progress: 15
2023-10-05 17:26:06.207 11678-11972 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : cb85e069-9c20-46db-ad26-426d4eee20d8, progress_percent : 15, }
2023-10-05 17:26:06.207 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:06.215 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:06.231 11678-11678 CordovaBackgroundUpload com.appname D initManager: ef43bd1e-38e5-4033-a214-0ff3526ae74d (RUNNING) Progress: 15
2023-10-05 17:26:06.232 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADING","progress":15}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:06.233 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172606: videos.html: prepareUpload(): video uploader - cb85e069-9c20-46db-ad26-426d4eee20d8 progress: 15%
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:07.068 11678-11972 CordovaBackgroundUpload com.appname I handleProgress: ef43bd1e-38e5-4033-a214-0ff3526ae74d Progress: 27
2023-10-05 17:26:07.069 11678-11972 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : cb85e069-9c20-46db-ad26-426d4eee20d8, progress_percent : 27, }
2023-10-05 17:26:07.069 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:07.073 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:07.090 11678-11678 CordovaBackgroundUpload com.appname D initManager: ef43bd1e-38e5-4033-a214-0ff3526ae74d (RUNNING) Progress: 27
2023-10-05 17:26:07.091 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADING","progress":27}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:07.091 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172607: videos.html: prepareUpload(): video uploader - cb85e069-9c20-46db-ad26-426d4eee20d8 progress: 27%
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:08.014 11678-11972 CordovaBackgroundUpload com.appname I handleProgress: ef43bd1e-38e5-4033-a214-0ff3526ae74d Progress: 43
2023-10-05 17:26:08.015 11678-11972 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : cb85e069-9c20-46db-ad26-426d4eee20d8, progress_percent : 43, }
2023-10-05 17:26:08.015 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:08.021 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:08.037 11678-11678 CordovaBackgroundUpload com.appname D initManager: ef43bd1e-38e5-4033-a214-0ff3526ae74d (RUNNING) Progress: 43
2023-10-05 17:26:08.039 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADING","progress":43}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:08.039 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172608: videos.html: prepareUpload(): video uploader - cb85e069-9c20-46db-ad26-426d4eee20d8 progress: 43%
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:09.000 11678-11972 CordovaBackgroundUpload com.appname I handleProgress: ef43bd1e-38e5-4033-a214-0ff3526ae74d Progress: 59
2023-10-05 17:26:09.000 11678-11972 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : cb85e069-9c20-46db-ad26-426d4eee20d8, progress_percent : 59, }
2023-10-05 17:26:09.000 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:09.005 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:09.020 11678-11678 CordovaBackgroundUpload com.appname D initManager: ef43bd1e-38e5-4033-a214-0ff3526ae74d (RUNNING) Progress: 59
2023-10-05 17:26:09.022 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADING","progress":59}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:09.022 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172609: videos.html: prepareUpload(): video uploader - cb85e069-9c20-46db-ad26-426d4eee20d8 progress: 59%
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:10.000 11678-11972 CordovaBackgroundUpload com.appname I handleProgress: ef43bd1e-38e5-4033-a214-0ff3526ae74d Progress: 75
2023-10-05 17:26:10.001 11678-11972 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : cb85e069-9c20-46db-ad26-426d4eee20d8, progress_percent : 75, }
2023-10-05 17:26:10.002 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:10.007 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:10.023 11678-11678 CordovaBackgroundUpload com.appname D initManager: ef43bd1e-38e5-4033-a214-0ff3526ae74d (RUNNING) Progress: 75
2023-10-05 17:26:10.026 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADING","progress":75}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:10.026 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172610: videos.html: prepareUpload(): video uploader - cb85e069-9c20-46db-ad26-426d4eee20d8 progress: 75%
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:11.023 11678-11972 CordovaBackgroundUpload com.appname I handleProgress: ef43bd1e-38e5-4033-a214-0ff3526ae74d Progress: 90
2023-10-05 17:26:11.023 11678-11972 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : cb85e069-9c20-46db-ad26-426d4eee20d8, progress_percent : 90, }
2023-10-05 17:26:11.024 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:11.030 11678-11972 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:11.049 11678-11678 CordovaBackgroundUpload com.appname D initManager: ef43bd1e-38e5-4033-a214-0ff3526ae74d (RUNNING) Progress: 90
2023-10-05 17:26:11.053 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADING","progress":90}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:11.053 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172611: videos.html: prepareUpload(): video uploader - cb85e069-9c20-46db-ad26-426d4eee20d8 progress: 90%
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:33.509 11678-11969 WM-WorkerWrapper com.appname I Worker result SUCCESS for Work [ id=ef43bd1e-38e5-4033-a214-0ff3526ae74d, tags={ com.spoon.backgroundfileupload.UploadTask, work_tag_upload } ]
2023-10-05 17:26:33.525 11678-11678 ConnectivityManager com.appname D StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:4996)] [androidx.work.impl.utils.NetworkApi21.unregisterNetworkCallbackCompat(NetworkApi21.kt:31)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.stopTracking(NetworkStateTracker.kt:154)] [androidx.work.impl.constraints.trackers.ConstraintTracker.removeListener(ConstraintTracker.kt:73)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.kt:80)] [androidx.work.impl.constraints.WorkConstraintsTrackerImpl.replace(WorkConstraintsTracker.kt:92)] [androidx.work.impl.background.greedy.GreedyScheduler.removeConstraintTrackingFor(GreedyScheduler.java:243)] [androidx.work.impl.background.greedy.GreedyScheduler.onExecuted(GreedyScheduler.java:229)] [androidx.work.impl.Processor.onExecuted(Processor.java:385)] [androidx.work.impl.Processor$FutureListener.run(Processor.java:484)]
2023-10-05 17:26:33.548 11678-11678 CordovaBackgroundUpload com.appname D Task succeeded: ef43bd1e-38e5-4033-a214-0ff3526ae74d
2023-10-05 17:26:33.548 11678-11678 CordovaBackgroundUpload com.appname D eventLabel='Uploader failed inexplicably' error='Data {}'
2023-10-05 17:26:33.551 11678-11971 CordovaBackgroundUpload com.appname D eventLabel='Uploader onSuccess' uploadId='cb85e069-9c20-46db-ad26-426d4eee20d8' response='{"result":{"code":200,"message":"Success"},"file":{"filename":"20231005202622-tfumadNK.mp4","fileSize":92631086}} '
2023-10-05 17:26:33.554 11678-11678 chromium com.appname I [INFO:CONSOLE(36)] "Uploader EVENT {"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","eventId":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADED","serverResponse":"{\"result\":{\"code\":200,\"message\":\"Success\"},\"file\":{\"filename\":\"20231005202622-tfumadNK.mp4\",\"fileSize\":92631086}} \n","statusCode":200}", source: file:///android_asset/www/scripts/uploadFile.js (36)
2023-10-05 17:26:33.554 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172633: videos.html: prepareUpload(): video uploader - upload complete{"id":"cb85e069-9c20-46db-ad26-426d4eee20d8","eventId":"cb85e069-9c20-46db-ad26-426d4eee20d8","state":"UPLOADED","serverResponse":"{\"result\":{\"code\":200,\"message\":\"Success\"},\"file\":{\"filename\":\"20231005202622-tfumadNK.mp4\",\"fileSize\":92631086}} \n","statusCode":200}
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:33.558 11678-11898 CordovaBackgroundUpload com.appname D eventLabel='ACK event cb85e069-9c20-46db-ad26-426d4eee20d8'
2023-10-05 17:26:55.221 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172655: videos.html: openFilePicker(): selected video file file:///sdcard/.transforms/synthetic/picker/0/com.android.providers.media.photopicker/media/1000006861.mp4
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:56.094 11678-11678 ViewRootIm...nActivity] com.appname I ViewPostIme pointer 0
2023-10-05 17:26:56.151 11678-11678 ViewRootIm...nActivity] com.appname I ViewPostIme pointer 1
2023-10-05 17:26:56.160 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172656: videos.html: uploadEventVideo(): starting video file upload
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:56.180 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172656: videos.html: prepareUpload(): background transfer payload {"id":"c5905f36-5bd0-4cec-92aa-93dfd3d4d59b","filePath":"file:///sdcard/.transforms/synthetic/picker/0/com.android.providers.media.photopicker/media/1000006861.mp4","fileKey":"file","serverUrl":"https://examples.net/dev/send_backgroundFile.php","notificationTitle":"Uploading videos","headers":{},"parameters":{}}
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:56.188 11678-11678 chromium com.appname I [INFO:CONSOLE(152)] "20231005172656: videos.html: prepareUpload(): background transfer init start
", source: file:///android_asset/www/shared/scripts/shared.js (152)
2023-10-05 17:26:56.193 11678-11898 System.err com.appname W java.lang.IllegalStateException: initManager was called twice
2023-10-05 17:26:56.195 11678-11898 System.err com.appname W at com.spoon.backgroundfileupload.FileTransferBackground.initManager(FileTransferBackground.java:156)
2023-10-05 17:26:56.196 11678-11898 System.err com.appname W at com.spoon.backgroundfileupload.FileTransferBackground.lambda$execute$0$FileTransferBackground(FileTransferBackground.java:127)
2023-10-05 17:26:56.196 11678-11898 System.err com.appname W at com.spoon.backgroundfileupload.-$$Lambda$FileTransferBackground$xtREFTivl98JYTVt3692myy3y1A.run(Unknown Source:8)
2023-10-05 17:26:56.197 11678-11898 System.err com.appname W at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
2023-10-05 17:26:56.197 11678-11898 System.err com.appname W at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
2023-10-05 17:26:56.198 11678-11898 System.err com.appname W at java.lang.Thread.run(Thread.java:1012)
2023-10-05 17:26:56.215 11678-11801 CordovaBackgroundUpload com.appname D startUpload: Starting worker via work manager
2023-10-05 17:26:56.216 11678-11801 CordovaBackgroundUpload com.appname D eventLabel=Uploader starting uploads via worker0
2023-10-05 17:26:56.268 11678-11969 ConnectivityManager com.appname D StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4322)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:4886)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4853)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4827)] [androidx.work.impl.utils.NetworkApi24.registerDefaultNetworkCallbackCompat(NetworkApi24.kt:28)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.startTracking(NetworkStateTracker.kt:139)] [androidx.work.impl.constraints.trackers.ConstraintTracker.addListener(ConstraintTracker.kt:57)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.kt:82)] [androidx.work.impl.constraints.WorkConstraintsTrackerImpl.replace(WorkConstraintsTracker.kt:92)] [androidx.work.impl.background.greedy.GreedyScheduler.schedule(GreedyScheduler.java:170)] [androidx.work.impl.Schedulers.schedule(Schedulers.java:119)] [androidx.work.impl.utils.EnqueueRunnable.scheduleWorkInBackground(EnqueueRunnable.java:135)] [androidx.work.impl.utils.EnqueueRunnable.run(EnqueueRunnable.java:95)] [androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)] [java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)] [java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)] [java.lang.Thread.run(Thread.java:1012)]
2023-10-05 17:26:56.295 11678-11678 CordovaBackgroundUpload com.appname D Task succeeded: 1c281e2f-bf40-46b3-821f-a5ced5e3a361
2023-10-05 17:26:56.295 11678-11678 CordovaBackgroundUpload com.appname D eventLabel='Uploader failed inexplicably' error='Data {}'
2023-10-05 17:26:56.309 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:56.313 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:56.315 11678-12204 CordovaBackgroundUpload com.appname I handleProgress: 1c281e2f-bf40-46b3-821f-a5ced5e3a361 Progress: 0
2023-10-05 17:26:56.316 11678-12204 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : c5905f36-5bd0-4cec-92aa-93dfd3d4d59b, progress_percent : 0, }
2023-10-05 17:26:56.316 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:56.320 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:56.337 11678-11678 CordovaBackgroundUpload com.appname D initManager: 1c281e2f-bf40-46b3-821f-a5ced5e3a361 (RUNNING) Progress: 0
2023-10-05 17:26:57.090 11678-12204 CordovaBackgroundUpload com.appname I handleProgress: 1c281e2f-bf40-46b3-821f-a5ced5e3a361 Progress: 14
2023-10-05 17:26:57.092 11678-12204 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : c5905f36-5bd0-4cec-92aa-93dfd3d4d59b, progress_percent : 14, }
2023-10-05 17:26:57.092 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:57.108 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:57.126 11678-11678 CordovaBackgroundUpload com.appname D initManager: 1c281e2f-bf40-46b3-821f-a5ced5e3a361 (RUNNING) Progress: 14
2023-10-05 17:26:58.019 11678-12204 CordovaBackgroundUpload com.appname I handleProgress: 1c281e2f-bf40-46b3-821f-a5ced5e3a361 Progress: 47
2023-10-05 17:26:58.020 11678-12204 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : c5905f36-5bd0-4cec-92aa-93dfd3d4d59b, progress_percent : 47, }
2023-10-05 17:26:58.020 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:58.026 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:58.043 11678-11678 CordovaBackgroundUpload com.appname D initManager: 1c281e2f-bf40-46b3-821f-a5ced5e3a361 (RUNNING) Progress: 47
2023-10-05 17:26:59.008 11678-12204 CordovaBackgroundUpload com.appname I handleProgress: 1c281e2f-bf40-46b3-821f-a5ced5e3a361 Progress: 82
2023-10-05 17:26:59.009 11678-12204 CordovaBackgroundUpload com.appname D handleProgress: Progress data: Data {progress_id : c5905f36-5bd0-4cec-92aa-93dfd3d4d59b, progress_percent : 82, }
2023-10-05 17:26:59.009 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification
2023-10-05 17:26:59.014 11678-12204 CordovaBackgroundUpload com.appname D Upload Notification Exit
2023-10-05 17:26:59.029 11678-11678 CordovaBackgroundUpload com.appname D initManager: 1c281e2f-bf40-46b3-821f-a5ced5e3a361 (RUNNING) Progress: 82
2023-10-05 17:27:09.432 11678-11969 WM-WorkerWrapper com.appname I Worker result SUCCESS for Work [ id=1c281e2f-bf40-46b3-821f-a5ced5e3a361, tags={ com.spoon.backgroundfileupload.UploadTask, work_tag_upload } ]
2023-10-05 17:27:09.444 11678-11678 ConnectivityManager com.appname D StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:4996)] [androidx.work.impl.utils.NetworkApi21.unregisterNetworkCallbackCompat(NetworkApi21.kt:31)] [androidx.work.impl.constraints.trackers.NetworkStateTracker24.stopTracking(NetworkStateTracker.kt:154)] [androidx.work.impl.constraints.trackers.ConstraintTracker.removeListener(ConstraintTracker.kt:73)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.kt:80)] [androidx.work.impl.constraints.WorkConstraintsTrackerImpl.replace(WorkConstraintsTracker.kt:92)] [androidx.work.impl.background.greedy.GreedyScheduler.removeConstraintTrackingFor(GreedyScheduler.java:243)] [androidx.work.impl.background.greedy.GreedyScheduler.onExecuted(GreedyScheduler.java:229)] [androidx.work.impl.Processor.onExecuted(Processor.java:385)] [androidx.work.impl.Processor$FutureListener.run(Processor.java:484)]
2023-10-05 17:27:09.462 11678-11678 CordovaBackgroundUpload com.appname D Task succeeded: 1c281e2f-bf40-46b3-821f-a5ced5e3a361
2023-10-05 17:27:09.462 11678-11678 CordovaBackgroundUpload com.appname D eventLabel='Uploader failed inexplicably' error='Data {}'
2023-10-05 17:27:09.466 11678-11982 CordovaBackgroundUpload com.appname D eventLabel='Uploader onSuccess' uploadId='c5905f36-5bd0-4cec-92aa-93dfd3d4d59b' response='{"result":{"code":200,"message":"Success"},"file":{"filename":"20231005202704-xLkyNzy0.mp4","fileSize":40450481}} '
I am trying to call FileTransferManager.init right before a user uploads a file. That means it can be called multiple times during an app session if the user uploads multiple files or leaves and returns to the upload page. If it is initialized a second time, the callback is never called.
Here is the Android Studio log output from 2 file upload attempts. The first attempt 'cb85e069-9c20-46db-ad26-426d4eee20d8' logs the console output that is in the callback. The second attempt doesn't log any console output from the callback. Both attempts are from the same app session.