Ionic Battery Optimization


#1

My ionic app has a background activity of about 19 - 20%, and sucks a lot of battery. Is there any way to optimize it? I don’t have any intervals running or anything, so I’m not sure what’s going on. Here’s my plugin list:

      "ionic-plugin-keyboard": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-x-socialsharing": {},
      "cordova-plugin-google-analytics": {},
      "cordova-plugin-add-swift-support": {},
      "cordova-plugin-screen-orientation": {},
      "cordova-plugin-apprate": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-splashscreen": {},
      "cordova-clipboard": {},
      "cordova-plugin-network-information": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-inappbrowser": {}

#2

You are talking about Android I guess?

What is your ionic info output?


#3

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 3.1.4
Cordova Platforms  : android 6.3.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.9.2 
ios-sim    : 6.1.2 
Node       : v8.4.0
npm        : 5.5.1 
OS         : macOS High Sierra
Xcode      : Xcode 9.1 Build version 9B55 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

#4

This plugin could helps you to optimize an eventual GPS tracking : https://ionicframework.com/docs/native/background-geolocation/
BackgroundGeolocationConfig options can provide to you many attributes like desiredAccuracy, interval, saveBatteryOnBackground, activitiesInterval… which are relative to your targeted platform only (iOS or Android perhaps others).
Keep me informed.