Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Build and validate the web and native projects.

This is useful to run in CI to verify that the plugin builds for all platforms.

> **Note**: On Android, the plugin's Gradle module cannot be assembled into an AAR, because it depends on the JS engine through a local `.aar` file and the Android Gradle Plugin rejects direct local `.aar` dependencies when building an AAR. `verify:android` therefore runs `test`, `lint`, and `compileReleaseKotlin` instead of `build`. This is not a limitation in practice: the plugin is consumed as a Gradle source module (`project(':capacitor-background-runner')`), never as a published AAR. To validate Android packaging end to end, build a consuming app — for example `apps/example-app/android` — which exercises manifest merging, resource merging, and native library packaging.

#### `npm run lint` / `npm run fmt`

Check formatting and code quality, autoformat/autofix if possible.
Expand Down
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,12 @@ Apple requires privacy descriptions to be specified in `Info.plist` for location

## Android

Insert the following line to `android/app/build.gradle`:
No additional setup is required.

```diff
...
If you are upgrading an existing Android project, the following leftovers from earlier versions are no longer used and can be deleted:

repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
+ dirs '../../node_modules/@capacitor/background-runner/android/src/main/libs', 'libs'
}
}
...

```

If you are upgrading from 1.0.5 with an existing Android project, be sure to delete the `android-js-engine-release.aar` from `android/src/main/libs`.
- in `android/app/build.gradle`, the `dirs '../../node_modules/@capacitor/background-runner/android/src/main/libs', 'libs'` line inside the `flatDir` block
- `android/src/main/libs/android-js-engine-release.aar`, if you upgraded from 1.0.5 or earlier

### Geolocation

Expand Down
8 changes: 0 additions & 8 deletions apps/example-app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,3 @@ try {
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}

// BEGIN @capacitor/background-runner
repositories {
flatDir {
dirs '../../../../packages/capacitor-plugin/android/src/main/libs'
}
}
// END @capacitor/background-runner
18 changes: 4 additions & 14 deletions packages/capacitor-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,12 @@ Apple requires privacy descriptions to be specified in `Info.plist` for location

## Android

Insert the following line to `android/app/build.gradle`:
No additional setup is required.

```diff
...
If you are upgrading an existing Android project, the following leftovers from earlier versions are no longer used and can be deleted:

repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
+ dirs '../../node_modules/@capacitor/background-runner/android/src/main/libs', 'libs'
}
}
...

```

If you are upgrading from 1.0.5 with an existing Android project, be sure to delete the `android-js-engine-release.aar` from `android/src/main/libs`.
- in `android/app/build.gradle`, the `dirs '../../node_modules/@capacitor/background-runner/android/src/main/libs', 'libs'` line inside the `flatDir` block
- `android/src/main/libs/android-js-engine-release.aar`, if you upgraded from 1.0.5 or earlier

### Geolocation

Expand Down
10 changes: 3 additions & 7 deletions packages/capacitor-plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError = false
lint {
abortOnError = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
Expand All @@ -48,16 +48,12 @@ android {
repositories {
google()
mavenCentral()
flatDir {
dirs "./src/main/libs", "libs"
dirs "$rootDir/../node_modules/@capacitor/background-runner/android/src/main/libs", "libs"
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':capacitor-android')
implementation ":android-js-engine-release@aar"
implementation files('src/main/libs/android-js-engine-release.aar')
implementation "androidx.work:work-runtime-ktx:$workManagerVersion"
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.core:core:$androidxCoreVersion"
Expand Down
6 changes: 2 additions & 4 deletions packages/capacitor-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"ios/Sources",
"ios/Tests",
"Package.swift",
"scripts/install_libs.js",
"CapacitorBackgroundRunner.podspec"
],
"author": "Ionic Team",
Expand All @@ -33,7 +32,7 @@
"scripts": {
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
"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'",
"verify:android": "cd android && ./gradlew clean build test && cd ..",
"verify:android": "cd android && ./gradlew clean test lint compileReleaseKotlin && cd ..",
"verify:web": "npm run build",
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
Expand All @@ -47,8 +46,7 @@
"pack": "npm run build && ./scripts/copy-native-sdks.sh && pnpm pack && mv ./capacitor-background-runner-*.tgz ../../",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
"postinstall": "node ./scripts/install_libs.js"
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@capacitor/android": "next",
Expand Down
69 changes: 0 additions & 69 deletions packages/capacitor-plugin/scripts/install_libs.js

This file was deleted.

Loading