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
735 stars 336 forks source link

Support for SDK 34 #347

Open anindya2791 opened 8 months ago

anindya2791 commented 8 months ago

This should solve https://github.com/Vydia/react-native-background-upload/issues/343 Thanks @sandeep14

Summary

Test Plan

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS ✅❌
Android ✅❌

Checklist

mtshv commented 4 months ago

hey @anindya2791 I've implemented your changes and it indeed builds and works as expected. Thanks for your work (cc @sandeep14)

However, I have issues with uploading my APK to the google play store due to

"message": "You must let us know whether your app uses any Foreground Service permissions.",
"status": "PERMISSION_DENIED"

I think it might be related to the net.gotev:uploadservice-okhttp version bump: https://github.com/Vydia/react-native-background-upload/pull/347/files#diff-197b190e4a3512994d2cebed8aff5479ff88e136b8cc7a4b148ec9c3945bd65aR67

See this issue: https://github.com/gotev/android-upload-service/issues/660


If you guys have the same issue, or any ideas, how to solve it, please let me know.

anindya2791 commented 4 months ago

hey @anindya2791 I've implemented your changes and it indeed builds and works as expected. Thanks for your work (cc @sandeep14)

However, I have issues with uploading my APK to the google play store due to

"message": "You must let us know whether your app uses any Foreground Service permissions.",
"status": "PERMISSION_DENIED"

I think it might be related to the net.gotev:uploadservice-okhttp version bump: https://github.com/Vydia/react-native-background-upload/pull/347/files#diff-197b190e4a3512994d2cebed8aff5479ff88e136b8cc7a4b148ec9c3945bd65aR67

See this issue: gotev/android-upload-service#660

If you guys have the same issue, or any ideas, how to solve it, please let me know.

I think you need to declare the uses-permission in your AndroidManifest.xml

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

afaik, this is a play store mandate for Android 13+

anindya2791 commented 4 months ago

We are using this in RN 0.72.7 with SDK <= 34 so far no issues reported by users. Can we get this merged?

kevinmartin33 commented 4 months ago

To solve the FOREGROUND_SERVICE_DATA_SYNC error on the playstore I have use the work of tomit87 he moved service to worker And I applied to this library

react-native-background-upload+6.6.0.patch

mtshv commented 4 months ago

@kevinmartin33 thank you so much for sharing your solution for this problem! Will try your suggested approach <3


@anindya2791 thank you for the response, unfortunately explicitly declaring android.permission.FOREGROUND_SERVICE nor android.permission.FOREGROUND_SERVICE_DATA_SYNC did not resolve the issue.

both permission declarations still result in:

"message": "You must let us know whether your app uses any Foreground Service permissions.",
"status": "PERMISSION_DENIED"
Abdelsattar commented 3 months ago

hey @mtshv did you solve PERMISSION_DENIED problem ? and how ?

NicTorgersen commented 2 months ago

@Abdelsattar @mtshv Read here: https://github.com/expo/expo/issues/26846#issuecomment-1929129620

mtshv commented 2 months ago

hey @Abdelsattar In the end I provided the reasoning for the foreground permission usage to google reviewers as well as video showcasing the upload functionality. It worked. Looks like this was 1-time thing.

I crafted my explantion text based on this comment: https://github.com/gotev/android-upload-service/issues/660#issuecomment-2273465855

Good luck!