Vydia / react-native-background-upload

Upload files in your React Native app even while it's backgrounded. Supports Android and iOS, including camera roll assets.
MIT License
730 stars 333 forks source link

Android starts uploading and then nothing #351

Open zvitek opened 4 months ago

zvitek commented 4 months ago

Hi, have you encountered similar behavior on Android? I select a file to send for upload. I get back the promise and the uploadId. But that's all. No event with process is called anymore.

The problem is only on the Android side.

For API level 30, the problem described above occurs. For API level 34, the whole application crashes.

Thanks a lot!

react-native-background-upload: 6.6.0 react-native: 0.73.6

await new Promise((resolve, reject) => {
Upload.startUpload(options)
    .then((uploadId) => {
        console.log('Upload started', uploadId); // <-- called
        Upload.addListener('progress', uploadId, (data) => {
            setProgress(data.progress); // <-- no called
        });
        Upload.addListener('cancelled', uploadId, (data) => {
            reject(data); // <-- no called
        });
        Upload.addListener('error', uploadId, (data) => {
            reject(data.error); // <-- no called
        });
        Upload.addListener('completed', uploadId, (data) => {
            resolve(true); // <-- no called
        });
    })
    .catch(reject);
});
narychen commented 4 months ago

Same problem. It is ok on ios, but nothing happened on android. No error. No log. Just nothing.

GunnarAK commented 3 months ago

Did you try setting breakpoints to debug the issue?

VBarzionov commented 2 months ago

Have got same problem.

In my case It is fixed by adding this to your ProGuard configuration (proguard-rules.pro) : -keep class net.gotev.uploadservice.** { *; }

It mentioned in README.md but not in title project page.

aliyanlatif commented 1 month ago

@zvitek same problem, were you able to solve the issue?

aliyanlatif commented 1 month ago

i updated the build.gradle file of the react native background upload package with the following changes mentioned in the URL and it worked

https://github.com/Vydia/react-native-background-upload/pull/347/commits/f9a29c5963039c6f53e350fe19d6e6fdf1d7b73a