Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Cordova background plugin- (Keep the app running in background)

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 5.43k
    Comment on it

    Hello Readers,

    Cordova background mode plugin keeps the app running in background mode. When app pause in background mode and the system keeps open the network but doesn't send data until  app resumes. This plugin helps in those applications which are network communication based or directly interact to the users.

    This plugin supports Android, iOS ( iOS8 or more), Wp8 platforms.


    First of all we need to install the plugin through CLI:

    $ cordova plugin add


    This plugin creates cordova.plugins.backgroundMode object and this object has some methods which are as follows:


    • backgroundMode.enable :  Background mode of app will be activated when app goes to the background mode once and deactivated when it comes to foreground mode. To make this happen we need to call backgroundMode.enable method.


    • backgroundMode.disable : When background mode has been disabled it will pause the app in background mode.


    • backgroundMode.isEnabled : This method provides the information to the user about background is enabled or disabled. Provides true or false values.


    • backgroundMode.isActive :  This method works when background mode has been activated or not.


    • backgroundMode.onactive : We can notify the user that background mode has been activated.
    cordova.plugins.backgroundMode.onactivate = function() {};


    • backgroundMode.ondeactive :  We can notify the user that background mode has been deactivated.
    cordova.plugins.backgroundMode.ondeactivate = function() {};


    • backgroundMode.onfailure :  We can notify the users that background mode could not been activated. This method generates error code which describes the error.
    cordova.plugins.backgroundMode.onfailure = function(errorCode) {};


    For more details please visit: Click here

    Hope this will help you :)

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: