Configure Android battery optimisation settings
npm install capacitor-android-battery-settings
npx cap sync
Add the following to your AndroidManifest.xml
above the <application>
tag.
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
isBatteryOptimizationEnabled() => Promise<{ isUnrestricted: boolean; }>
Returns: Promise<{ isUnrestricted: boolean; }>
requestBatteryOptimizationDisabled() => Promise<void>