Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.95 KB

INSTALL-ANDROID.md

File metadata and controls

62 lines (45 loc) · 1.95 KB

Android Setup (REQUIRED)

With yarn

$ yarn add @transistorsoft/capacitor-background-fetch
$ npx cap sync

With npm

$ npm install --save @transistorsoft/capacitor-background-fetch
$ npx cap sync

Gradle Configuration

The SDK requires a custom maven url in the root android/build.gradle:

📂 android/build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()
+       maven {
+           // capacitor-background-fetch
+           url("${project(':transistorsoft-capacitor-background-fetch').projectDir}/libs")
+       }

    }
}

Configure proguard-rules.pro

  1. In Android Studio, edit android/app/proguard-rules.pro (ProGuard rules for android.app).
  2. Add the following rule:
# [capacitor-background-fetch]
-keep class **BackgroundFetchHeadlessTask { *; }

Precise event-scheduling with forceAlarmManager: true:

Only If you wish to use precise scheduling of events with forceAlarmManager: true, Android 14 (SDK 34), has restricted usage of "AlarmManager exact alarms". To continue using precise timing of events with Android 14, you can manually add this permission to your AndroidManifest. Otherwise, the plugin will gracefully fall-back to "in-exact AlarmManager scheduling":

📂 In your AndroidManifest, add the following permission (exactly as-shown):

  <manifest>
      <uses-permission android:minSdkVersion="34" android:name="android.permission.USE_EXACT_ALARM" />
      .
      .
      .
  </manifest>

⚠️ It has been announced that Google Play Store has plans to impose greater scrutiny over usage of this permission (which is why the plugin does not automatically add it).