[Cordova][cordova] plugin to prevent the app from going to sleep while in background.
Most mobile operating systems are multitasking capable, but most apps dont need to run while in background and not present for the user. Therefore they pause the app in background mode and resume the app before switching to foreground mode.
The system keeps all network connections open while in background, but does not deliver the data until the app resumes.
### Plugin's Purpose
This cordova plug-in can be used for applications, who rely on continuous network communication independent of from direct user interactions and remote push notifications.
### :bangbang: Store Compliance :bangbang:
The plugin focuses on enterprise-only distribution and may not compliant with all public store vendors.
## Overview
1.[Supported Platforms](#supported-platforms)
2.[Installation](#installation)
3.[ChangeLog](#changelog)
4.[Usage](#usage)
5.[Examples](#examples)
6.[Platform specifics](#platform-specifics)
## Supported Platforms
- __iOS__ (_including iOS8_)
- __Android__ _(SDK >=11)_
- __WP8__
## Installation
The plugin can either be installed from git repository, from local file system through the [Command-line Interface][CLI]. Or cloud based through [PhoneGap Build][PGB].
The following example demonstrates how to enable the background mode after device is ready. The mode itself will be activated when the app has entered the background.
text:'Running in background for more than 5s now.'
});
},5000);
}
},false);
```
## Platform specifics
### Android customization
To indicate that the app is executing tasks in background and being paused would disrupt the user, the plug-in has to create a notification while in background - like a download progress bar.
#### Override defaults
The title, ticker and text for that notification can be customized as follows:
```javascript
cordova.plugins.backgroundMode.setDefaults({
title:String,
ticker:String,
text:String
})
```
By default the app will come to foreground when taping on the notification. That can be changed also.
```javascript
cordova.plugins.backgroundMode.setDefaults({
resume:false
})
```
#### Modify the currently displayed notification
It's also possible to modify the currently displayed notification while in background.
```javascript
cordova.plugins.backgroundMode.configure({
title:String,
...
})
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## License
This software is released under the [Apache 2.0 License][apache2_license].