react-native-background-upload icon indicating copy to clipboard operation
react-native-background-upload copied to clipboard

Support of Android 8.1 and above

Open Diwei-Chen opened this issue 6 years ago • 4 comments

Followed the solution as proposed in https://github.com/Vydia/react-native-background-upload/issues/59

After turning off the notification setting, now Android is throwing:

Error: Android Oreo requires a notification configuration for the service to run. https://developer.android.com/reference/android/content/Context.html#startForegroundService(android.content.Intent)

The targetSdkVersion in our android/app/build.gradle is 27 and compileSdkVersion is 28.

We found some solutions on stack overflow https://stackoverflow.com/questions/47531742/startforeground-fail-after-upgrade-to-android-8-1 but not sure if we're doing the right thing.

Any ideas, please?

Related documentation: https://developer.android.com/reference/android/content/Context.html#startForegroundService(android.content.Intent)

Diwei-Chen avatar Aug 22 '19 08:08 Diwei-Chen

We are having the same issue. @Diwei-Chen did you solve this satisfactorily? Could you share how?

Maintainers - would be good to include instructions for configuring this in Android > 8.1

NicholasIoanJones avatar Nov 07 '19 13:11 NicholasIoanJones

AFAIK it should be enough to enable the notification, by setting options: { notification: { enabled: true ... } when doing an upload

reime005 avatar Nov 07 '19 14:11 reime005

@NicholasIoanJones I am sorry to tell but without enough knowledge to help improve the Android code, we ended up with replacing this package with the fetch method in rn-fetch-blob in the sacrifice of background upload capability on Android.

Diwei-Chen avatar Nov 07 '19 23:11 Diwei-Chen

I solved my problem adding this line <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> in my android manifest

deyson-b avatar Nov 16 '19 02:11 deyson-b