joaolss / react-native-background-worker Goto Github PK
View Code? Open in Web Editor NEWPerform tasks in background using Android's WorkManager
Home Page: https://www.npmjs.com/package/react-native-background-worker
License: MIT License
Perform tasks in background using Android's WorkManager
Home Page: https://www.npmjs.com/package/react-native-background-worker
License: MIT License
How to solve these problems?
What went wrong:
A problem occurred evaluating project ':react-native-background-worker'.> Plugin with id 'maven' not found.
What went wrong:
A problem occurred configuring project ':react-native-background-worker'.> compileSdkVersion is not specified. Please add it to build.gradle
Build file 'C:\Projects\Project1\node_modules\react-native-background-worker\android\build.gradle' line: 20
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
kotlin_version = '1.7.20'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
/**
This is the configuration block to customize your React Native Android app.
By default you don't need to apply any configuration, just uncomment the lines you need.
/
react {
/ Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
// root = file("../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
// codegenDir = file("../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "prodDebug"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
//
// The path to the CLI configuration file. Default is empty.
// bundleConfig = file(../rn-cli.config.js)
//
// The name of the generated asset file containing your JS bundle
// bundleAssetName = "MyApplication.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
// entryFile = file("../js/MyApplication.android.js")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
}
/**
/**
def jscFlavor = 'org.webkit:android-jsc-intl:+'
Date.toLocaleString
and String.localeCompare
thatandroid {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
namespace "com.youtubelive"
defaultConfig {
applicationId "com.youtubelive"
minSdkVersion rootProject.ext.minSdkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Is your feature request related to a problem? Please describe.
Is this library supports Android 5?
Describe the bug
foregroundServices not allowed exception is coming only in android12 devices. here iam using react-native-background-worker to fetch foreground service(iam calling one api to notify something to user) when my app is in background.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
it is working fine in other os version mobiles except android 12 and api level > 31
Smartphone (please complete the following information):
Hello,
would it be possible to include an example app with the examples from the readme?
I am very interested in using this library.
If you can provide me with some extra details i can build it myself and pull request it.
Thank you.
Now there is no execution order, that is, if a task is created with the queue type with data:
1
2
3
4
then their call will be done in the reverse order in blocking mode when the device is locked, or even in which it is not clear.
Can this be fixed? Do not execute the second until success in the first is returned?
And if so, what should I do if I wanted to execute a task everyday at midnight? What would be the best aproach?
In blocking mode, after 4 retry, the workflow no longer starts.
I have noticed that the jobs enqueued are not being persisted upon closing and reopening the App.
To Reproduce
Steps to reproduce the behavior:
Smartphone (please complete the following information):
I would suggest make an solution on case when I need to dynamic change of reapeatInterval in worker.
For instance.
I need to create worker with 15 minutes reapet time for the first workflow occurs but later when workflow end I need to manipulete repaet interval to Increase or decrease its time. Ofcourse not less than 15 minutes.
Right now to do that I need to create helper consts that will take care of new interval values and when this value (baseInterval, newInterval) are not equals I have cancel actual worker and start new one with new interval. That cause warning on rn 63.4 -> "registerHeadelessTask or registerCancellableHeadlessTask called multiple times for same key"
Maybe you guys have better solution for that right now. Maybe ingeration in package will be unnecessary.
Regards
In the documentation, payload is marked as an optional parameter, but without it, workflow does not start. If you transfer an empty object to payload then everything is ok.
True, what is the difference between them?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.