@capacitor/background-runner 3.0.0 → 4.0.0-dev.28jul2026
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapacitorBackgroundRunner.podspec +1 -1
- package/Package.swift +2 -3
- package/README.md +8 -8
- package/android/build.gradle +7 -11
- package/android/src/main/libs/android-js-engine-release.aar +0 -0
- package/dist/docs-api.json +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/definitions.d.ts +2 -2
- package/dist/esm/definitions.js.map +1 -1
- package/package.json +12 -13
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target
|
|
14
|
+
s.ios.deployment_target = '16.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.swift_version = '5.1'
|
|
17
17
|
end
|
package/Package.swift
CHANGED
|
@@ -5,7 +5,7 @@ import PackageDescription
|
|
|
5
5
|
|
|
6
6
|
let package = Package(
|
|
7
7
|
name: "CapacitorBackgroundRunner",
|
|
8
|
-
platforms: [.iOS(.
|
|
8
|
+
platforms: [.iOS(.v16), .macOS(.v13)],
|
|
9
9
|
products: [
|
|
10
10
|
// Products define the executables and libraries a package produces, making them visible to other packages.
|
|
11
11
|
.library(
|
|
@@ -14,7 +14,7 @@ let package = Package(
|
|
|
14
14
|
)
|
|
15
15
|
],
|
|
16
16
|
dependencies: [
|
|
17
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "
|
|
17
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "9.0.0-alpha.5")
|
|
18
18
|
],
|
|
19
19
|
targets: [
|
|
20
20
|
// Targets are the basic building blocks of a package, defining a module or a test suite.
|
|
@@ -23,7 +23,6 @@ let package = Package(
|
|
|
23
23
|
name: "CapacitorBackgroundRunner",
|
|
24
24
|
dependencies: [
|
|
25
25
|
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
26
|
-
.product(name: "Cordova", package: "capacitor-swift-pm"),
|
|
27
26
|
"RunnerEngine"
|
|
28
27
|
],
|
|
29
28
|
path: "ios/Sources/CapacitorBackgroundRunner"
|
package/README.md
CHANGED
|
@@ -189,14 +189,14 @@ On load, Background Runner will automatically register a
|
|
|
189
189
|
background task that will be scheduled and run once your app is
|
|
190
190
|
backgrounded.
|
|
191
191
|
|
|
192
|
-
| Prop | Type | Description
|
|
193
|
-
| --------------- | -------------------- |
|
|
194
|
-
| **`label`** | <code>string</code> | The name of the runner, used in logs.
|
|
195
|
-
| **`src`** | <code>string</code> | The path to the runner JavaScript file, relative to the app bundle.
|
|
196
|
-
| **`event`** | <code>string</code> | The name of the event that will be called when the OS executes the background task.
|
|
197
|
-
| **`repeat`** | <code>boolean</code> | If background task should repeat based on the interval set in `interval`.
|
|
198
|
-
| **`interval`** | <code>number</code> | The number of minutes after the
|
|
199
|
-
| **`autoStart`** | <code>boolean</code> | Automatically register and schedule background task on app load.
|
|
192
|
+
| Prop | Type | Description | Since |
|
|
193
|
+
| --------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
|
|
194
|
+
| **`label`** | <code>string</code> | The name of the runner, used in logs. | 1.0.0 |
|
|
195
|
+
| **`src`** | <code>string</code> | The path to the runner JavaScript file, relative to the app bundle. | 1.0.0 |
|
|
196
|
+
| **`event`** | <code>string</code> | The name of the event that will be called when the OS executes the background task. | 1.0.0 |
|
|
197
|
+
| **`repeat`** | <code>boolean</code> | If background task should repeat based on the interval set in `interval`. | 1.0.0 |
|
|
198
|
+
| **`interval`** | <code>number</code> | The number of minutes after the app is put into the background in which the background task should begin. If `repeat` is true, this also specifies the number of minutes between each execution. | 1.0.0 |
|
|
199
|
+
| **`autoStart`** | <code>boolean</code> | Automatically register and schedule background task on app load. | 1.0.0 |
|
|
200
200
|
|
|
201
201
|
### Examples
|
|
202
202
|
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
3
|
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
4
|
-
|
|
4
|
+
androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.19.0'
|
|
5
5
|
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
6
6
|
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
7
7
|
workManagerVersion = project.hasProperty('workManagerVersion') ? rootProject.ext.workManagerVersion : '2.11.0'
|
|
@@ -9,27 +9,23 @@ ext {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
buildscript {
|
|
12
|
-
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '2.2.20'
|
|
13
12
|
repositories {
|
|
14
13
|
google()
|
|
15
14
|
mavenCentral()
|
|
16
15
|
}
|
|
17
16
|
dependencies {
|
|
18
|
-
classpath 'com.android.tools.build:gradle:
|
|
19
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
17
|
+
classpath 'com.android.tools.build:gradle:9.2.1'
|
|
20
18
|
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
apply plugin: 'com.android.library'
|
|
25
|
-
apply plugin: 'org.jetbrains.kotlin.android'
|
|
26
23
|
|
|
27
24
|
android {
|
|
28
25
|
namespace = "com.capacitorjs.plugins.backgroundrunner"
|
|
29
|
-
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
26
|
+
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 37
|
|
30
27
|
defaultConfig {
|
|
31
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
32
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
28
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 26
|
|
33
29
|
versionCode 1
|
|
34
30
|
versionName "1.0"
|
|
35
31
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -37,7 +33,7 @@ android {
|
|
|
37
33
|
buildTypes {
|
|
38
34
|
release {
|
|
39
35
|
minifyEnabled false
|
|
40
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
36
|
+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
lintOptions {
|
|
@@ -61,10 +57,10 @@ repositories {
|
|
|
61
57
|
dependencies {
|
|
62
58
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
63
59
|
implementation project(':capacitor-android')
|
|
64
|
-
implementation
|
|
60
|
+
implementation ":android-js-engine-release@aar"
|
|
65
61
|
implementation "androidx.work:work-runtime-ktx:$workManagerVersion"
|
|
66
62
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
67
|
-
implementation "androidx.core:core
|
|
63
|
+
implementation "androidx.core:core:$androidxCoreVersion"
|
|
68
64
|
testImplementation "junit:junit:$junitVersion"
|
|
69
65
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
70
66
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
Binary file
|
package/dist/docs-api.json
CHANGED
|
@@ -948,7 +948,7 @@
|
|
|
948
948
|
"name": "example"
|
|
949
949
|
}
|
|
950
950
|
],
|
|
951
|
-
"docs": "The number of minutes after the
|
|
951
|
+
"docs": "The number of minutes after the app is put into the background in which the background task should begin.\n\nIf `repeat` is true, this also specifies the number of minutes between each execution.",
|
|
952
952
|
"complexTypes": [],
|
|
953
953
|
"type": "number"
|
|
954
954
|
},
|
package/dist/docs.json
CHANGED
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
"name": "example"
|
|
370
370
|
}
|
|
371
371
|
],
|
|
372
|
-
"docs": "The number of minutes after the
|
|
372
|
+
"docs": "The number of minutes after the app is put into the background in which the background task should begin.\n\nIf `repeat` is true, this also specifies the number of minutes between each execution.",
|
|
373
373
|
"complexTypes": [],
|
|
374
374
|
"type": "number"
|
|
375
375
|
},
|
|
@@ -25,7 +25,7 @@ export interface BackgroundRunnerConfig {
|
|
|
25
25
|
*/
|
|
26
26
|
repeat: boolean;
|
|
27
27
|
/**
|
|
28
|
-
* The number of minutes after the
|
|
28
|
+
* The number of minutes after the app is put into the background in which the background task should begin.
|
|
29
29
|
*
|
|
30
30
|
* If `repeat` is true, this also specifies the number of minutes between each execution.
|
|
31
31
|
*
|
|
@@ -76,7 +76,7 @@ declare module '@capacitor/cli' {
|
|
|
76
76
|
*/
|
|
77
77
|
repeat: boolean;
|
|
78
78
|
/**
|
|
79
|
-
* The number of minutes after the
|
|
79
|
+
* The number of minutes after the app is put into the background in which the background task should begin.
|
|
80
80
|
*
|
|
81
81
|
* If `repeat` is true, this also specifies the number of minutes between each execution.
|
|
82
82
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\nexport interface BackgroundRunnerConfig {\n /**\n * The name of the runner, used in logs.\n *\n * @since 1.0.0\n */\n label: string;\n /**\n * The path to the runner JavaScript file, relative to the app bundle.\n *\n * @since 1.0.0\n */\n src: string;\n /**\n * The name of the event that will be called when the OS executes the background task.\n *\n * @since 1.0.0\n */\n event: string;\n /**\n * If background task should repeat based on the interval set in `interval`.\n *\n * @since 1.0.0\n */\n repeat: boolean;\n /**\n * The number of minutes after the
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\nimport type { PermissionState, PluginListenerHandle } from '@capacitor/core';\n\nexport interface BackgroundRunnerConfig {\n /**\n * The name of the runner, used in logs.\n *\n * @since 1.0.0\n */\n label: string;\n /**\n * The path to the runner JavaScript file, relative to the app bundle.\n *\n * @since 1.0.0\n */\n src: string;\n /**\n * The name of the event that will be called when the OS executes the background task.\n *\n * @since 1.0.0\n */\n event: string;\n /**\n * If background task should repeat based on the interval set in `interval`.\n *\n * @since 1.0.0\n */\n repeat: boolean;\n /**\n * The number of minutes after the app is put into the background in which the background task should begin.\n *\n * If `repeat` is true, this also specifies the number of minutes between each execution.\n *\n * @since 1.0.0\n */\n interval: number;\n /**\n * Automatically register and schedule background task on app load.\n *\n * @since 1.0.0\n */\n autoStart?: boolean;\n}\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * On load, Background Runner will automatically register a\n * background task that will be scheduled and run once your app is\n * backgrounded.\n */\n BackgroundRunner?: {\n /**\n * The name of the runner, used in logs.\n *\n * @since 1.0.0\n * @example \"com.example.background.task\"\n */\n label: string;\n /**\n * The path to the runner JavaScript file, relative to the app bundle.\n *\n * @since 1.0.0\n * @example \"runners/background.js\"\n */\n src: string;\n /**\n * The name of the event that will be called when the OS executes the background task.\n *\n * @since 1.0.0\n * @example \"myCustomEvent\"\n */\n event: string;\n /**\n * If background task should repeat based on the interval set in `interval`.\n *\n * @since 1.0.0\n * @example true\n */\n repeat: boolean;\n /**\n * The number of minutes after the app is put into the background in which the background task should begin.\n *\n * If `repeat` is true, this also specifies the number of minutes between each execution.\n *\n * @since 1.0.0\n * @example 15\n */\n interval: number;\n /**\n * Automatically register and schedule background task on app load.\n *\n * @since 1.0.0\n * @example true\n */\n autoStart?: boolean;\n };\n }\n}\n\nexport type API = 'geolocation' | 'notifications';\n\nexport interface PermissionStatus {\n geolocation: PermissionState;\n notifications: PermissionState;\n}\n\nexport interface DispatchEventOptions {\n /**\n * The runner label to dispatch the event to\n *\n * @since 1.0.0\n */\n label: string;\n /**\n * The name of the registered event listener.\n *\n * @since 1.0.0\n */\n event: string;\n details: { [key: string]: any };\n}\n\nexport interface RequestPermissionOptions {\n apis: API[];\n}\n\nexport interface RegisterBackgroundTaskOptions {\n runner: BackgroundRunnerConfig;\n}\n\nexport interface NotificationActionEvent {\n actionTypeId: string;\n notificationId: number;\n}\n\nexport interface BackgroundRunnerPlugin {\n /**\n * Check permissions for the various Capacitor device APIs.\n *\n * @since 1.0.0\n */\n checkPermissions(): Promise<PermissionStatus>;\n /**\n * Request permission to display local notifications.\n *\n * @since 1.0.0\n */\n requestPermissions(options: RequestPermissionOptions): Promise<PermissionStatus>;\n /**\n * Dispatches an event to the configured runner.\n * @param options\n * @since 1.0.0\n */\n dispatchEvent<T = void>(options: DispatchEventOptions): Promise<T>;\n /**\n * Add a listener for notification actions.\n *\n * @since 2.1.1\n */\n addListener(\n eventName: 'backgroundRunnerNotificationReceived',\n listenerFunc: (event: NotificationActionEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove notification action listeners for this plugin.\n *\n * @since 2.1.1\n */\n removeNotificationListeners(): Promise<void>;\n}\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n BackgroundRunner?: BackgroundRunnerConfig;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/background-runner",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-dev.28jul2026",
|
|
4
4
|
"description": "Capacitor Background Runner",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
34
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
35
|
-
"verify:ios": "xcodebuild -scheme CapacitorBackgroundRunner -destination generic/platform=iOS && xcodebuild test -scheme CapacitorBackgroundRunner -destination 'platform=iOS Simulator,OS=
|
|
35
|
+
"verify:ios": "xcodebuild -scheme CapacitorBackgroundRunner -destination generic/platform=iOS && xcodebuild test -scheme CapacitorBackgroundRunner -destination 'platform=iOS Simulator,OS=26.0.1,name=iPhone 17 Pro'",
|
|
36
36
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
37
37
|
"verify:web": "npm run build",
|
|
38
38
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"docgen": "docgen --api BackgroundRunnerPlugin --output-readme README.md --output-json dist/docs.json",
|
|
44
44
|
"docgen-api": "docgen --api CapacitorAPI --output-readme API.md --output-json dist/docs-api.json && node ./scripts/combine_docs.js",
|
|
45
45
|
"build-sdk": "./scripts/build-native-sdks.sh",
|
|
46
|
-
"build": "npm run clean && npm run docgen && npm run docgen-api && tsc && rollup -c rollup.config.
|
|
46
|
+
"build": "npm run clean && npm run docgen && npm run docgen-api && tsc && rollup -c rollup.config.mjs --bundleConfigAsCjs && npm run build-sdk && ./scripts/copy-native-sdks.sh && npm pack && mv ./capacitor-background-runner-*.tgz ../../ && ./scripts/copy-readme.sh",
|
|
47
47
|
"pack": "npm run build && ./scripts/copy-native-sdks.sh && npm pack && mv ./capacitor-background-runner-*.tgz ../../",
|
|
48
48
|
"clean": "rimraf ./dist",
|
|
49
49
|
"watch": "tsc --watch",
|
|
@@ -51,24 +51,24 @@
|
|
|
51
51
|
"postinstall": "node ./scripts/install_libs.js"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@capacitor/android": "
|
|
55
|
-
"@capacitor/cli": "
|
|
56
|
-
"@capacitor/core": "
|
|
57
|
-
"@capacitor/docgen": "^0.3.
|
|
58
|
-
"@capacitor/ios": "
|
|
54
|
+
"@capacitor/android": "next",
|
|
55
|
+
"@capacitor/cli": "next",
|
|
56
|
+
"@capacitor/core": "next",
|
|
57
|
+
"@capacitor/docgen": "^0.3.1",
|
|
58
|
+
"@capacitor/ios": "next",
|
|
59
59
|
"@ionic/eslint-config": "^0.4.0",
|
|
60
60
|
"@ionic/prettier-config": "^4.0.0",
|
|
61
61
|
"@ionic/swiftlint-config": "^2.0.0",
|
|
62
62
|
"eslint": "^8.57.1",
|
|
63
63
|
"prettier": "^3.6.2",
|
|
64
64
|
"prettier-plugin-java": "^2.7.7",
|
|
65
|
-
"rimraf": "^6.1.
|
|
66
|
-
"rollup": "^4.53.
|
|
65
|
+
"rimraf": "^6.1.0",
|
|
66
|
+
"rollup": "^4.53.2",
|
|
67
67
|
"swiftlint": "^2.0.0",
|
|
68
68
|
"typescript": "^5.9.3"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@capacitor/core": ">=
|
|
71
|
+
"@capacitor/core": ">=9.0.0-alpha.5"
|
|
72
72
|
},
|
|
73
73
|
"prettier": "@ionic/prettier-config",
|
|
74
74
|
"swiftlint": "@ionic/swiftlint-config",
|
|
@@ -82,6 +82,5 @@
|
|
|
82
82
|
"android": {
|
|
83
83
|
"src": "android"
|
|
84
84
|
}
|
|
85
|
-
}
|
|
86
|
-
"gitHead": "4559cf862ec7575f579a3bc38257efebe552daaf"
|
|
85
|
+
}
|
|
87
86
|
}
|