mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-07 23:03:19 +08:00
commit
186aace5dd
@ -12,6 +12,7 @@ import {AppRate} from './plugins/apprate';
|
|||||||
import {AppVersion} from './plugins/appversion';
|
import {AppVersion} from './plugins/appversion';
|
||||||
import {Badge} from './plugins/badge';
|
import {Badge} from './plugins/badge';
|
||||||
import {BackgroundGeolocation} from './plugins/background-geolocation';
|
import {BackgroundGeolocation} from './plugins/background-geolocation';
|
||||||
|
import {BackgroundMode} from './plugins/backgroundmode';
|
||||||
import {BarcodeScanner} from './plugins/barcodescanner';
|
import {BarcodeScanner} from './plugins/barcodescanner';
|
||||||
import {Base64ToGallery} from './plugins/base64togallery';
|
import {Base64ToGallery} from './plugins/base64togallery';
|
||||||
import {BatteryStatus} from './plugins/batterystatus';
|
import {BatteryStatus} from './plugins/batterystatus';
|
||||||
@ -68,6 +69,7 @@ export {
|
|||||||
AppVersion,
|
AppVersion,
|
||||||
Badge,
|
Badge,
|
||||||
BackgroundGeolocation,
|
BackgroundGeolocation,
|
||||||
|
BackgroundMode,
|
||||||
BarcodeScanner,
|
BarcodeScanner,
|
||||||
Base64ToGallery,
|
Base64ToGallery,
|
||||||
BatteryStatus,
|
BatteryStatus,
|
||||||
|
105
src/plugins/backgroundmode.ts
Normal file
105
src/plugins/backgroundmode.ts
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
import {Plugin, Cordova} from './plugin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Background Mode
|
||||||
|
* @description
|
||||||
|
* 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, vist: https://github.com/katzer/cordova-plugin-background-mode#android-customization
|
||||||
|
*@usage
|
||||||
|
* ```js
|
||||||
|
* import {BackgroundMode} from 'ionic-native';
|
||||||
|
*
|
||||||
|
* BackgroundMode.enable();
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
plugin: 'de.appplant.cordova.plugin.background-mode',
|
||||||
|
pluginRef: 'cordova.plugins.backgroundMode',
|
||||||
|
repo: 'https://github.com/katzer/cordova-plugin-background-mode',
|
||||||
|
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
||||||
|
})
|
||||||
|
export class BackgroundMode {
|
||||||
|
/**
|
||||||
|
* Enable the background mode.
|
||||||
|
* Once called, prevents the app from being puased while in background.
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
sync: true
|
||||||
|
})
|
||||||
|
static enable(): void{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the background mode.
|
||||||
|
* Once the background mode has been disabled, the app will be paused when in background.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static disable(): void{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if background mode is enabled or not.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static isEnabled(): Promise<boolean> {return; }
|
||||||
|
/**
|
||||||
|
* Can be used to get the information if the background mode is active.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
static isActive(): Promise<boolean> {return; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the default title, ticker and text.
|
||||||
|
* Available only for Android platform.
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
platforms: ['Android']
|
||||||
|
})
|
||||||
|
static setDefaults(options?:Configure):void{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify the displayed information.
|
||||||
|
* Available only for Android platform.
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
platforms: ['Android']
|
||||||
|
})
|
||||||
|
static update(options?:Configure):void{}
|
||||||
|
/**
|
||||||
|
* Sets a callback for a specific event
|
||||||
|
* Can be used to get notified or run function when the background mode has been activated, deactivated or failed.
|
||||||
|
* @param eventName The name of the event. Available events: activate, deactivate, failure
|
||||||
|
*/
|
||||||
|
@Cordova({
|
||||||
|
sync: true
|
||||||
|
})
|
||||||
|
static on(eventName: string, callback: any): void {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configurations items that can be updated.
|
||||||
|
*/
|
||||||
|
export interface Configure{
|
||||||
|
/**
|
||||||
|
*Title of the background task
|
||||||
|
*/
|
||||||
|
title?: String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*The text that scrolls itself on statusbar
|
||||||
|
*/
|
||||||
|
ticker?: String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Description of background task
|
||||||
|
*/
|
||||||
|
text?: String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Boolean, if true plugin will not display a notification. Default is false.
|
||||||
|
*/
|
||||||
|
silent?:boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Boolean. By default the app will come to foreground when taping on the notification. If false, plugin wont come to foreground when tapped.
|
||||||
|
*/
|
||||||
|
resume?:boolean;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user