Closed xts-bit closed 2 weeks ago
Where’s your Debug Logs from $ adb logcat?
@christocracy i updated please check again i see there is a error "05-27 22:14:11.802 211 215 E android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup0: Permission denied"
None of that references anything from the plug-in. See https://dontkillmyapp.com
@christocracy How to debug it? will it cause this problem in production ?
I have no idea what those logs mean. I suggest you modify device settings according to https://dontkillmyapp.com.
@christocracy Also after running the app for 10min it gave this warning " WARN No task registered for key BackgroundFetch" any idea about can be the issue? is it common?
I suggest you simplify your code. Comment-out all your “uploading” stuff and simply do a log statement.
them simulate tasks according to the Debugging section in README
@christocracy i tried remove all the upload stuff and just hit a api after 3 seconds it does any hit the api
Your api calls don’t concern me.
I’m only interested in seeing your callback function print a message to the logs.
@christocracy it found this error for just console.log("Hello World") in background "05-28 15:32:40.212 3098 7224 E BgTaskExecutorImpl: EXCLUSIVE background task FETCH_CONFIGS_FROM_PHENOTYPE was cancelled. 05-28 15:32:40.212 3098 7224 E BgTaskExecutorImpl: java.util.concurrent.CancellationException: Task was cancelled."
Can i give a github repo of the project?
Comment-out your entire BackgroundFetch.configure
block and replace it with this:
BackgroundFetch.configure({
minimumFetchInterval: 15,
stopOnTerminate: false,
startOnBoot: true,
enableHeadless: true,
requiredNetworkType: BackgroundFetch.NETWORK_TYPE_ANY
}, async (taskId:string) => {
console.log('[BackgroundFetch] taskId', taskId);
BackgroundFetch.finish(taskId);
}, (taskId:string) => {
console.log('[Fetch] TIMEOUT taskId:', taskId);
BackgroundFetch.finish(taskId);
});
While simulating events according to the README, observe and provide the logcat
results here:
$ adb logcat *:S ReactNative:V ReactNativeJS:V TSBackgroundFetch:V
@christocracy i cant see any message related to "Register Task" however i found out a log that says
05-29 13:04:15.946 7778 7778 D TSBackgroundFetch: ☯️ onPause
05-29 13:04:15.946 7778 7778 D TSBackgroundFetch: ☯️ onStop
What exactly are you executing to simulate the task?
@christocracy I am just uploading image to cloud for test purpose I am logging hello world in background
I’m not talking about your “upload” code.
what is the adb
command you’re using to simulate a fetch event. As documented in the readme.
@christocracy Chris it logs this:
05-29 20:40:26.666 11384 11447 D TSBackgroundFetch: - configure
05-29 20:40:26.666 11384 11447 D TSBackgroundFetch: - start
05-29 20:40:26.669 11384 11384 D TSBackgroundFetch: ☯️ onCreate
05-29 20:40:26.669 11384 11384 D TSBackgroundFetch: ☯️ onStart
05-29 20:40:26.669 11384 11384 D TSBackgroundFetch: ☯️ onResume
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: - registerTask: react-native-background-fetch (jobId: 999)
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: {
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "taskId": "react-native-background-fetch",
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "isFetchTask": true,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "minimumFetchInterval": 15,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "stopOnTerminate": false,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "requiredNetworkType": 1,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "requiresBatteryNotLow": false,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "requiresCharging": false,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "requiresDeviceIdle": false,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "requiresStorageNotLow": false,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "startOnBoot": true,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "jobService": "com.transistorsoft.rnbackgroundfetch.HeadlessTask",
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "forceAlarmManager": false,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "periodic": true,
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: "delay": -1
05-29 20:40:26.676 11384 11447 D TSBackgroundFetch: }
05-29 20:40:28.867 11384 11384 D TSBackgroundFetch: ☯️ onPause
05-29 20:40:28.867 11384 11384 D TSBackgroundFetch: ☯️ onStop
Are you not aware you can SIMULATE fetch events?
read the README to learn how to simulate events.
@christocracy yep it logs this "Running job [FORCED]"
Print the logs after simulating an event.
@christocracy Can you please tell me what if mean about "Print the logs after simulating an event"
i run this "adb shell cmd jobscheduler run -f
“Print the logs” = adb logcat *:S ReactNative:V ReactNativeJS:V TSBackgroundFetch:V
@christocracy When i run adb logcat '*:S ReactNative:V ReactNativeJS:V TSBackgroundFetch:V'
it log these messages related to TSBackgroundFetch:
05-29 21:26:58.960 14251 14251 D TSBackgroundFetch: ☯️ onCreate
05-29 21:26:58.960 14251 14251 D TSBackgroundFetch: ☯️ onStart
05-29 21:26:58.960 14251 14251 D TSBackgroundFetch: ☯️ onResume
05-29 21:26:58.960 14251 14315 D TSBackgroundFetch: - configure
05-29 21:26:58.960 14251 14315 D TSBackgroundFetch: - start
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: - registerTask: react-native-background-fetch (jobId: 999)
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: {
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "taskId": "react-native-background-fetch",
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "isFetchTask": true,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "minimumFetchInterval": 15,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "stopOnTerminate": false,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "requiredNetworkType": 1,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "requiresBatteryNotLow": false,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "requiresCharging": false,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "requiresDeviceIdle": false,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "requiresStorageNotLow": false,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "startOnBoot": true,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "jobService": "com.transistorsoft.rnbackgroundfetch.HeadlessTask",
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "forceAlarmManager": false,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "periodic": true,
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: "delay": -1
05-29 21:26:58.961 14251 14315 D TSBackgroundFetch: }
i run this "adb shell cmd jobscheduler run -f
999"
Are you replacing <your.application.id>
with your app’s actual application id?
@christocracy maybe i am doing wrong is this correct?
james@Jamess-MacBook-Air FoodApp % adb shell cmd jobscheduler run -f com.foodapp 999
Running job [FORCED]
james@Jamess-MacBook-Air FoodApp %
@christocracy Can you give me a simple rn component code snippet that i can copy test and check for any problem with my Android emulator?
Can you give me a simple rn component code snippet that i can copy test
That’s exactly what I posted above.
@christocracy I already tried that code can you tell what is a positive log that I can see on console to assure that things are correct
what is a positive log that I can see on console to assure that things are correct
TSBackgroundFetch: - Background Fetch event received: react-native-background-fetch
ReactNativeJS: '[BackgroundFetch]', 'react-native-background-fetch' <------------------- this is a console.log
TSBackgroundFetch: - finish: react-native-background-fetch
TSBackgroundFetch: - jobFinished
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
Your Environment
Expected Behavior
It should upload the file to the cloud when i Terminate the app on Android when i call the uploadHandler function and. the data.message from the API is "successfully" it should call the ImageHandler function and run it in the background
Actual Behavior
It's not uploading files to the cloud and not hitting the API tried this thing many times and also check my server logs
Steps to Reproduce
Context
Debug logs