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

Not working on Android 8.0+

Open adamivancza opened this issue 5 years ago • 5 comments

I'm facing the same issue that's mentioned on this bug report: https://github.com/jamesisaac/react-native-background-task/issues/34

11-13 16:20:49.901 20728 20728 D BackgroundTask: Setting foreground false
11-13 16:20:49.901 20728 20728 D BackgroundTask: Committing job schedule
11-13 16:20:52.160 20728 20728 D ReactNative: ReactInstanceManager.detachViewFromInstance()
11-13 16:29:17.859 22953 22987 D BackgroundTask: Job is running

Then nothing happens - my actual task is never called after this point. Any idea how can I resolve this? Obviously setting targetSdk to 25 is not a valid solution anymore since Google requires us to use 26.

adamivancza avatar Nov 13 '18 16:11 adamivancza

Same to me. I have extensively tested. It does not work on Android 8.0+. No matter what I do, the defined task never gets running.

12-28 11:17:32.010  7497  7497 D ReactNative: ReactInstanceManager.ctor()
12-28 11:17:32.036  7497  7497 D ReactNative: ReactInstanceManager.createReactContextInBackground()
12-28 11:17:32.036  7497  7497 D ReactNative: ReactInstanceManager.recreateReactContextInBackgroundInner()
12-28 11:17:33.241  7497  7497 D ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()
12-28 11:17:33.242  7497  7497 D ReactNative: ReactInstanceManager.recreateReactContextInBackground()
12-28 11:17:33.243  7497  7497 D ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
12-28 11:17:33.254  7497  7530 D ReactNative: ReactInstanceManager.createReactContext()
12-28 11:17:33.557  7497  7530 D ReactNative: Initializing React Xplat Bridge.
12-28 11:17:33.560  7497  7530 D ReactNative: Initializing React Xplat Bridge before initializeBridge
12-28 11:17:33.565  7497  7530 D ReactNative: Initializing React Xplat Bridge after initializeBridge
12-28 11:17:33.566  7497  7530 D ReactNative: CatalystInstanceImpl.runJSBundle()
12-28 11:17:33.566  7497  7534 D ReactNative: ReactInstanceManager.setupReactContext()
12-28 11:17:33.567  7497  7534 D ReactNative: CatalystInstanceImpl.initialize()
12-28 11:17:33.625  7497  7534 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
12-28 11:17:34.027  7497  7533 I ReactNativeJS: Running application "helloWord_native" with appParams: {"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
12-28 11:17:57.743  7497  7497 D ReactNative: ReactInstanceManager.detachViewFromInstance()

xuancong84 avatar Dec 28 '18 03:12 xuancong84

same error is occurring in my app. plz tell me any solution.

anshumanburman avatar Jul 31 '19 06:07 anshumanburman

@anshumanburman eventually for android we've switched to https://github.com/vikeri/react-native-background-job

adamivancza avatar Jul 31 '19 08:07 adamivancza

The library react-native-background-job works only on Android at the moment. To fix the bug on Android 8, a PR has been opened: https://github.com/jamesisaac/react-native-background-task/pull/64

qlerebours avatar Aug 30 '19 09:08 qlerebours

For those of you still looking for a solution, it seems (according to their README) that https://github.com/transistorsoft/react-native-background-fetch now supports both Android and iOS with a common API, i.e. exactly like this package does.

danielfx90 avatar Aug 24 '20 18:08 danielfx90