Background Mode


Cordova plugin to prevent the app from going to sleep while in background. Requires Cordova plugin: cordova-plugin-background-mode. For more info about plugin, visit: https://github.com/katzer/cordova-plugin-background-mode



If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic 防止后台睡觉 Background Mode插件的安装(Installation)

ionic cordova plugin add cordova-plugin-background-mode npm install @ionic-native/background-mode
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/background-mode

Ionic 防止后台睡觉 Background Mode插件支持的平台(Supported Platforms)

  • AmazonFire OS
  • Android
  • Browser
  • iOS
  • Windows

Ionic 防止后台睡觉 Background Mode插件的用法(Usage)

import { BackgroundMode } from '@ionic-native/background-mode/ngx';

constructor(private backgroundMode: BackgroundMode) { }