Commit 13a60d52 by Sebastián Katzer

Remove background-mode plugin

parent 259434fa
......@@ -9,7 +9,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="de.appplant.cordova.plugin.background.ForegroundService" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.ClearReceiver" />
<activity android:exported="false" android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.localnotification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
......
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/de.appplant.cordova.plugin.background-mode/www/background-mode.js",
"id": "de.appplant.cordova.plugin.background-mode.BackgroundMode",
"clobbers": [
"cordova.plugins.backgroundMode",
"plugin.backgroundMode"
]
},
{
"file": "plugins/nl.x-services.plugins.toast/www/Toast.js",
"id": "nl.x-services.plugins.toast.Toast",
"clobbers": [
......@@ -38,7 +30,6 @@ module.exports = [
module.exports.metadata =
// TOP OF METADATA
{
"de.appplant.cordova.plugin.background-mode": "0.6.2",
"nl.x-services.plugins.toast": "2.0.3",
"de.appplant.cordova.plugin.local-notification": "0.8.0rc2",
"org.apache.cordova.device": "0.3.1-dev"
......
cordova.define("de.appplant.cordova.plugin.background-mode.BackgroundMode", function(require, exports, module) { /*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var exec = require('cordova/exec'),
channel = require('cordova/channel');
// Override back button action to prevent being killed
document.addEventListener('backbutton', function () {}, false);
// Called before 'deviceready' listener will be called
channel.onCordovaReady.subscribe(function () {
// Device plugin is ready now
channel.onCordovaInfoReady.subscribe(function () {
// Set the defaults
exports.setDefaults({});
});
// Only enable WP8 by default
if (['WinCE', 'Win32NT'].indexOf(device.platform) > -1) {
exports.enable();
}
});
/**
* @private
*
* Flag indicated if the mode is enabled.
*/
exports._isEnabled = false;
/**
* @private
*
* Flag indicated if the mode is active.
*/
exports._isActive = false;
/**
* @private
*
* Default values of all available options.
*/
exports._defaults = {
title: 'App is running in background',
text: 'Doing heavy tasks.',
ticker: 'App is running in background',
resume: true
};
/**
* Activates the background mode. When activated the application
* will be prevented from going to sleep while in background
* for the next time.
*/
exports.enable = function () {
this._isEnabled = true;
cordova.exec(null, null, 'BackgroundMode', 'enable', []);
};
/**
* Deactivates the background mode. When deactivated the application
* will not stay awake while in background.
*/
exports.disable = function () {
this._isEnabled = false;
cordova.exec(null, null, 'BackgroundMode', 'disable', []);
};
/**
* List of all available options with their default value.
*
* @return {Object}
*/
exports.getDefaults = function () {
return this._defaults;
};
/**
* Overwrite default settings
*
* @param {Object} overrides
* Dict of options which shall be overridden
*/
exports.setDefaults = function (overrides) {
var defaults = this.getDefaults();
for (var key in defaults) {
if (overrides.hasOwnProperty(key)) {
defaults[key] = overrides[key];
}
}
if (device.platform == 'Android') {
cordova.exec(null, null, 'BackgroundMode', 'configure', [defaults, false]);
}
};
/**
* Configures the notification settings for Android.
* Will be merged with the defaults.
*
* @param {Object} options
* Dict with key/value pairs
*/
exports.configure = function (options) {
var settings = this.mergeWithDefaults(options);
if (device.platform == 'Android') {
cordova.exec(null, null, 'BackgroundMode', 'configure', [settings, true]);
}
};
/**
* If the mode is enabled or disabled.
*
* @return {Boolean}
*/
exports.isEnabled = function () {
return this._isEnabled;
};
/**
* If the mode is active.
*
* @return {Boolean}
*/
exports.isActive = function () {
return this._isActive;
};
/**
* Called when the background mode has been activated.
*/
exports.onactivate = function () {};
/**
* Called when the background mode has been deaktivated.
*/
exports.ondeactivate = function () {};
/**
* Called when the background mode could not been activated.
*
* @param {Integer} errorCode
* Error code which describes the error
*/
exports.onfailure = function () {};
/**
* @private
*
* Merge settings with default values.
*
* @param {Object} options
* The custom options
*
* @return {Object}
* Default values merged
* with custom values
*/
exports.mergeWithDefaults = function (options) {
var defaults = this.getDefaults();
for (var key in defaults) {
if (!options.hasOwnProperty(key)) {
options[key] = defaults[key];
continue;
}
}
return options;
};
});
......@@ -13,10 +13,6 @@
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="BackgroundMode">
<param name="android-package" value="de.appplant.cordova.plugin.background.BackgroundMode" />
</feature>
<preference name="KeepRunning" value="true" />
<feature name="Toast">
<param name="android-package" value="nl.xservices.plugins.Toast" />
</feature>
......
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package de.appplant.cordova.plugin.background;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
public class BackgroundMode extends CordovaPlugin {
// Event types for callbacks
private enum Event {
ACTIVATE, DEACTIVATE, FAILURE
}
// Plugin namespace
private static final String JS_NAMESPACE = "cordova.plugins.backgroundMode";
// Flag indicates if the app is in background or foreground
private boolean inBackground = false;
// Flag indicates if the plugin is enabled or disabled
private boolean isDisabled = true;
// Flag indicates if the service is bind
private boolean isBind = false;
// Default settings for the notification
private static JSONObject defaultSettings = new JSONObject();
// Tmp config settings for the notification
private static JSONObject updateSettings;
// Used to (un)bind the service to with the activity
private final ServiceConnection connection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
// Nothing to do here
}
@Override
public void onServiceDisconnected(ComponentName name) {
// Nothing to do here
}
};
/**
* Executes the request.
*
* @param action The action to execute.
* @param args The exec() arguments.
* @param callback The callback context used when
* calling back into JavaScript.
*
* @return
* Returning false results in a "MethodNotFound" error.
*
* @throws JSONException
*/
@Override
public boolean execute (String action, JSONArray args,
CallbackContext callback) throws JSONException {
if (action.equalsIgnoreCase("configure")) {
JSONObject settings = args.getJSONObject(0);
boolean update = args.getBoolean(1);
if (update) {
setUpdateSettings(settings);
updateNotifcation();
} else {
setDefaultSettings(settings);
}
return true;
}
if (action.equalsIgnoreCase("enable")) {
enableMode();
return true;
}
if (action.equalsIgnoreCase("disable")) {
disableMode();
return true;
}
return false;
}
/**
* Called when the system is about to start resuming a previous activity.
*
* @param multitasking
* Flag indicating if multitasking is turned on for app
*/
@Override
public void onPause(boolean multitasking) {
super.onPause(multitasking);
inBackground = true;
startService();
}
/**
* Called when the activity will start interacting with the user.
*
* @param multitasking
* Flag indicating if multitasking is turned on for app
*/
@Override
public void onResume(boolean multitasking) {
super.onResume(multitasking);
inBackground = false;
stopService();
}
/**
* Called when the activity will be destroyed.
*/
@Override
public void onDestroy() {
super.onDestroy();
stopService();
}
/**
* Enable the background mode.
*/
private void enableMode() {
isDisabled = false;
if (inBackground) {
startService();
}
}
/**
* Disable the background mode.
*/
private void disableMode() {
stopService();
isDisabled = true;
}
/**
* Update the default settings for the notification.
*
* @param settings
* The new default settings
*/
private void setDefaultSettings(JSONObject settings) {
defaultSettings = settings;
}
/**
* Update the config settings for the notification.
*
* @param settings
* The tmp config settings
*/
private void setUpdateSettings(JSONObject settings) {
updateSettings = settings;
}
/**
* The settings for the new/updated notification.
*
* @return
* updateSettings if set or default settings
*/
protected static JSONObject getSettings() {
if (updateSettings != null)
return updateSettings;
return defaultSettings;
}
/**
* Called by ForegroundService to delete the update settings.
*/
protected static void deleteUpdateSettings() {
updateSettings = null;
}
/**
* Update the notification.
*/
private void updateNotifcation() {
if (isBind) {
stopService();
startService();
}
}
/**
* Bind the activity to a background service and put them into foreground
* state.
*/
private void startService() {
Activity context = cordova.getActivity();
Intent intent = new Intent(
context, ForegroundService.class);
if (isDisabled || isBind)
return;
try {
context.bindService(
intent, connection, Context.BIND_AUTO_CREATE);
fireEvent(Event.ACTIVATE, null);
context.startService(intent);
} catch (Exception e) {
fireEvent(Event.FAILURE, e.getMessage());
}
isBind = true;
}
/**
* Bind the activity to a background service and put them into foreground
* state.
*/
private void stopService() {
Activity context = cordova.getActivity();
Intent intent = new Intent(
context, ForegroundService.class);
if (!isBind)
return;
fireEvent(Event.DEACTIVATE, null);
context.unbindService(connection);
context.stopService(intent);
isBind = false;
}
/**
* Fire vent with some parameters inside the web view.
*
* @param event
* The name of the event
* @param params
* Optional arguments for the event
*/
private void fireEvent (Event event, String params) {
String eventName;
if (updateSettings != null && event != Event.FAILURE)
return;
switch (event) {
case ACTIVATE:
eventName = "activate"; break;
case DEACTIVATE:
eventName = "deactivate"; break;
default:
eventName = "failure";
}
String active = event == Event.ACTIVATE ? "true" : "false";
String flag = String.format("%s._isActive=%s;",
JS_NAMESPACE, active);
String fn = String.format("setTimeout('%s.on%s(%s)',0);",
JS_NAMESPACE, eventName, params);
final String js = flag + fn;
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
webView.loadUrl("javascript:" + js);
}
});
}
}
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package de.appplant.cordova.plugin.background;
import java.util.Timer;
import java.util.TimerTask;
import org.json.JSONObject;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
/**
* Puts the service in a foreground state, where the system considers it to be
* something the user is actively aware of and thus not a candidate for killing
* when low on memory.
*/
public class ForegroundService extends Service {
// Fixed ID for the 'foreground' notification
private static final int NOTIFICATION_ID = -574543954;
// Scheduler to exec periodic tasks
final Timer scheduler = new Timer();
// Used to keep the app alive
TimerTask keepAliveTask;
/**
* Allow clients to call on to the service.
*/
@Override
public IBinder onBind (Intent intent) {
return null;
}
/**
* Put the service in a foreground state to prevent app from being killed
* by the OS.
*/
@Override
public void onCreate () {
super.onCreate();
keepAwake();
}
@Override
public void onDestroy() {
super.onDestroy();
sleepWell();
}
/**
* Put the service in a foreground state to prevent app from being killed
* by the OS.
*/
public void keepAwake() {
final Handler handler = new Handler();
startForeground(NOTIFICATION_ID, makeNotification());
BackgroundMode.deleteUpdateSettings();
keepAliveTask = new TimerTask() {
@Override
public void run() {
handler.post(new Runnable() {
@Override
public void run() {
// Nothing to do here
// Log.d("BackgroundMode", "" + new Date().getTime());
}
});
}
};
scheduler.schedule(keepAliveTask, 0, 1000);
}
/**
* Stop background mode.
*/
private void sleepWell() {
stopForeground(true);
keepAliveTask.cancel();
}
/**
* Create a notification as the visible part to be able to put the service
* in a foreground state.
*
* @return
* A local ongoing notification which pending intent is bound to the
* main activity.
*/
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
private Notification makeNotification() {
JSONObject settings = BackgroundMode.getSettings();
Context context = getApplicationContext();
String pkgName = context.getPackageName();
Intent intent = context.getPackageManager()
.getLaunchIntentForPackage(pkgName);
Notification.Builder notification = new Notification.Builder(context)
.setContentTitle(settings.optString("title", ""))
.setContentText(settings.optString("text", ""))
.setTicker(settings.optString("ticker", ""))
.setOngoing(true)
.setSmallIcon(getIconResId());
if (intent != null && settings.optBoolean("resume")) {
PendingIntent contentIntent = PendingIntent.getActivity(
context, NOTIFICATION_ID, intent, PendingIntent.FLAG_CANCEL_CURRENT);
notification.setContentIntent(contentIntent);
}
if (Build.VERSION.SDK_INT < 16) {
// Build notification for HoneyComb to ICS
return notification.getNotification();
} else {
// Notification for Jellybean and above
return notification.build();
}
}
/**
* Retrieves the resource ID of the app icon.
*
* @return
* The resource ID of the app icon
*/
private int getIconResId () {
Context context = getApplicationContext();
Resources res = context.getResources();
String pkgName = context.getPackageName();
int resId;
resId = res.getIdentifier("icon", "drawable", pkgName);
return resId;
}
}
......@@ -6,7 +6,6 @@
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
07EF7CA952804739B03CB4EB /* APPBackgroundMode.m in Sources */ = {isa = PBXBuildFile; fileRef = FC90C5F7655742F7A2F6260D /* APPBackgroundMode.m */; };
1A68BCF10CCF44E68E4D5A1F /* Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = 861D9C8A19C8479794031087 /* Toast.m */; };
1D3623260D0F684500981E51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AppDelegate.m */; };
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
......@@ -42,7 +41,6 @@
7E7966E61810823500FA85AD /* icon-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DC1810823500FA85AD /* icon-small.png */; };
7E7966E71810823500FA85AD /* icon-small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DD1810823500FA85AD /* icon-small@2x.png */; };
95F7B7CD58D042F1A21EA9F2 /* CDVDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 6049F41C5141414CB5E334F8 /* CDVDevice.m */; };
A4947EFB031A45529C300D6B /* appbeep.wav in Resources */ = {isa = PBXBuildFile; fileRef = D06E9448A3634B2CB28C3E99 /* appbeep.wav */; };
D4A0D8761607E02300AEF8BB /* Default-568h@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */; };
E599728187B84453A916B456 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8ED2EA1A59441ED986119EC /* QuartzCore.framework */; };
18873003645648339D9B5F1E /* AppDelegate+APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = B2455FE33A80403399902502 /* AppDelegate+APPLocalNotification.m */; };
......@@ -111,7 +109,6 @@
7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; };
861D9C8A19C8479794031087 /* Toast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Toast.m; path = "nl.x-services.plugins.toast/Toast.m"; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* NotificationExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "NotificationExample-Info.plist"; path = "../NotificationExample-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
A280A4A360AC4E419CE00FBB /* APPBackgroundMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APPBackgroundMode.h; path = "de.appplant.cordova.plugin.background-mode/APPBackgroundMode.h"; sourceTree = "<group>"; };
B2CA862435D347FFB2213A84 /* CDVDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVDevice.h; path = org.apache.cordova.device/CDVDevice.h; sourceTree = "<group>"; };
BDA3511B19544DD1A3B57680 /* Toast+UIView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "Toast+UIView.m"; path = "nl.x-services.plugins.toast/Toast+UIView.m"; sourceTree = "<group>"; };
C8ED2EA1A59441ED986119EC /* QuartzCore.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
......@@ -120,7 +117,6 @@
EB87FDF31871DA8E0020F90C /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; name = www; path = ../../www; sourceTree = "<group>"; };
EB87FDF41871DAF40020F90C /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = ../../config.xml; sourceTree = "<group>"; };
F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = NotificationExample/config.xml; sourceTree = "<group>"; };
FC90C5F7655742F7A2F6260D /* APPBackgroundMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = APPBackgroundMode.m; path = "de.appplant.cordova.plugin.background-mode/APPBackgroundMode.m"; sourceTree = "<group>"; };
FF1EED1034F04D93903F6A34 /* Toast+UIView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Toast+UIView.h"; path = "nl.x-services.plugins.toast/Toast+UIView.h"; sourceTree = "<group>"; };
B2455FE33A80403399902502 /* AppDelegate+APPLocalNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "AppDelegate+APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/AppDelegate+APPLocalNotification.m"; sourceTree = "<group>"; fileEncoding = 4; };
15223883D7B2447C8F40F5DC /* APPLocalNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotification.m"; sourceTree = "<group>"; fileEncoding = 4; };
......@@ -234,8 +230,6 @@
children = (
6049F41C5141414CB5E334F8 /* CDVDevice.m */,
B2CA862435D347FFB2213A84 /* CDVDevice.h */,
FC90C5F7655742F7A2F6260D /* APPBackgroundMode.m */,
A280A4A360AC4E419CE00FBB /* APPBackgroundMode.h */,
BDA3511B19544DD1A3B57680 /* Toast+UIView.m */,
861D9C8A19C8479794031087 /* Toast.m */,
FF1EED1034F04D93903F6A34 /* Toast+UIView.h */,
......@@ -403,7 +397,6 @@
7E7966E11810823500FA85AD /* icon-50@2x.png in Resources */,
7E7966E51810823500FA85AD /* icon-76@2x.png in Resources */,
30FC414916E50CA1004E6F35 /* icon-72@2x.png in Resources */,
A4947EFB031A45529C300D6B /* appbeep.wav in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -436,7 +429,6 @@
1D3623260D0F684500981E51 /* AppDelegate.m in Sources */,
302D95F114D2391D003F00A1 /* MainViewController.m in Sources */,
95F7B7CD58D042F1A21EA9F2 /* CDVDevice.m in Sources */,
07EF7CA952804739B03CB4EB /* APPBackgroundMode.m in Sources */,
2E82A380B0E9459D817476B6 /* Toast+UIView.m in Sources */,
1A68BCF10CCF44E68E4D5A1F /* Toast.m in Sources */,
18873003645648339D9B5F1E /* AppDelegate+APPLocalNotification.m in Sources */,
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
......@@ -68,10 +68,6 @@
<string></string>
<key>NSMainNibFile~ipad</key>
<string></string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>UILaunchImages</key>
<array>
<dict>
......@@ -186,5 +182,5 @@
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</dict>
</plist>
\ No newline at end of file
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <Cordova/CDVPlugin.h>
@interface APPBackgroundMode : CDVPlugin {
AVAudioPlayer *audioPlayer;
BOOL enabled;
}
// Activate the background mode
- (void) enable:(CDVInvokedUrlCommand *)command;
// Deactivate the background mode
- (void) disable:(CDVInvokedUrlCommand *)command;
@end
\ No newline at end of file
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#import "APPBackgroundMode.h"
@implementation APPBackgroundMode
NSString *const kAPPBackgroundJsNamespace = @"cordova.plugins.backgroundMode";
NSString *const kAPPBackgroundEventActivate = @"activate";
NSString *const kAPPBackgroundEventDeactivate = @"deactivate";
NSString *const kAPPBackgroundEventFailure = @"failure";
#pragma mark -
#pragma mark Initialization methods
/**
* Initialize the plugin.
*/
- (void) pluginInitialize
{
[self disable:NULL];
[self configureAudioPlayer];
[self configureAudioSession];
[self observeLifeCycle];
}
/**
* Register the listener for pause and resume events.
*/
- (void) observeLifeCycle
{
NSNotificationCenter* listener = [NSNotificationCenter defaultCenter];
if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
[listener addObserver:self
selector:@selector(keepAwake)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
[listener addObserver:self
selector:@selector(stopKeepingAwake)
name:UIApplicationWillEnterForegroundNotification
object:nil];
[listener addObserver:self
selector:@selector(handleAudioSessionInterruption:)
name:AVAudioSessionInterruptionNotification
object:nil];
} else {
[self enable:NULL];
[self keepAwake];
}
}
#pragma mark -
#pragma mark Interface methods
/**
* Enable the mode to stay awake
* when switching to background for the next time.
*/
- (void) enable:(CDVInvokedUrlCommand *)command
{
enabled = YES;
}
/**
* Disable the background mode
* and stop being active in background.
*/
- (void) disable:(CDVInvokedUrlCommand *)command
{
enabled = NO;
[self stopKeepingAwake];
}
#pragma mark -
#pragma mark Core methods
/**
* Keep the app awake.
*/
- (void) keepAwake {
if (enabled) {
[audioPlayer play];
[self fireEvent:kAPPBackgroundEventActivate withParams:NULL];
}
}
/**
* Let the app going to sleep.
*/
- (void) stopKeepingAwake {
if (TARGET_IPHONE_SIMULATOR) {
NSLog(@"BackgroundMode: On simulator apps never pause in background!");
}
if (audioPlayer.isPlaying) {
[self fireEvent:kAPPBackgroundEventDeactivate withParams:NULL];
}
[audioPlayer pause];
}
/**
* Configure the audio player.
*/
- (void) configureAudioPlayer {
NSString* path = [[NSBundle mainBundle] pathForResource:@"appbeep"
ofType:@"wav"];
NSURL* url = [NSURL fileURLWithPath:path];
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url
error:NULL];
// Silent
audioPlayer.volume = 0;
// Infinite
audioPlayer.numberOfLoops = -1;
};
/**
* Configure the audio session.
*/
- (void) configureAudioSession {
AVAudioSession* session = [AVAudioSession
sharedInstance];
// Play music even in background and dont stop playing music
// even another app starts playing sound
[session setCategory:AVAudioSessionCategoryPlayback
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:NULL];
[session setActive:YES error:NULL];
};
#pragma mark -
#pragma mark Helper methods
/**
* Restart playing sound when interrupted by phone calls.
*/
- (void) handleAudioSessionInterruption:(NSNotification*)notification {
[self fireEvent:kAPPBackgroundEventDeactivate withParams:NULL];
[self keepAwake];
}
/**
* Method to fire an event with some parameters in the browser.
*/
- (void) fireEvent:(NSString*)event withParams:(NSString*)params
{
NSString* active = [event isEqualToString:kAPPBackgroundEventActivate] ? @"true" : @"false";
NSString* flag = [NSString stringWithFormat:@"%@._isActive=%@;",
kAPPBackgroundJsNamespace, active];
NSString* fn = [NSString stringWithFormat:@"setTimeout('%@.on%@(%@)',0);",
kAPPBackgroundJsNamespace, event, params];
NSString* js = [flag stringByAppendingString:fn];
[self.commandDelegate evalJs:js];
}
@end
......@@ -31,9 +31,6 @@
<feature name="Device">
<param name="ios-package" value="CDVDevice" />
</feature>
<feature name="BackgroundMode">
<param name="ios-package" value="APPBackgroundMode" />
</feature>
<feature name="Toast">
<param name="ios-package" value="Toast" />
</feature>
......
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/de.appplant.cordova.plugin.background-mode/www/background-mode.js",
"id": "de.appplant.cordova.plugin.background-mode.BackgroundMode",
"clobbers": [
"cordova.plugins.backgroundMode",
"plugin.backgroundMode"
]
},
{
"file": "plugins/nl.x-services.plugins.toast/www/Toast.js",
"id": "nl.x-services.plugins.toast.Toast",
"clobbers": [
......@@ -38,7 +30,6 @@ module.exports = [
module.exports.metadata =
// TOP OF METADATA
{
"de.appplant.cordova.plugin.background-mode": "0.6.2",
"nl.x-services.plugins.toast": "2.0.3",
"de.appplant.cordova.plugin.local-notification": "0.8.0rc2",
"org.apache.cordova.device": "0.3.1-dev"
......
cordova.define("de.appplant.cordova.plugin.background-mode.BackgroundMode", function(require, exports, module) { /*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var exec = require('cordova/exec'),
channel = require('cordova/channel');
// Override back button action to prevent being killed
document.addEventListener('backbutton', function () {}, false);
// Called before 'deviceready' listener will be called
channel.onCordovaReady.subscribe(function () {
// Device plugin is ready now
channel.onCordovaInfoReady.subscribe(function () {
// Set the defaults
exports.setDefaults({});
});
// Only enable WP8 by default
if (['WinCE', 'Win32NT'].indexOf(device.platform) > -1) {
exports.enable();
}
});
/**
* @private
*
* Flag indicated if the mode is enabled.
*/
exports._isEnabled = false;
/**
* @private
*
* Flag indicated if the mode is active.
*/
exports._isActive = false;
/**
* @private
*
* Default values of all available options.
*/
exports._defaults = {
title: 'App is running in background',
text: 'Doing heavy tasks.',
ticker: 'App is running in background',
resume: true
};
/**
* Activates the background mode. When activated the application
* will be prevented from going to sleep while in background
* for the next time.
*/
exports.enable = function () {
this._isEnabled = true;
cordova.exec(null, null, 'BackgroundMode', 'enable', []);
};
/**
* Deactivates the background mode. When deactivated the application
* will not stay awake while in background.
*/
exports.disable = function () {
this._isEnabled = false;
cordova.exec(null, null, 'BackgroundMode', 'disable', []);
};
/**
* List of all available options with their default value.
*
* @return {Object}
*/
exports.getDefaults = function () {
return this._defaults;
};
/**
* Overwrite default settings
*
* @param {Object} overrides
* Dict of options which shall be overridden
*/
exports.setDefaults = function (overrides) {
var defaults = this.getDefaults();
for (var key in defaults) {
if (overrides.hasOwnProperty(key)) {
defaults[key] = overrides[key];
}
}
if (device.platform == 'Android') {
cordova.exec(null, null, 'BackgroundMode', 'configure', [defaults, false]);
}
};
/**
* Configures the notification settings for Android.
* Will be merged with the defaults.
*
* @param {Object} options
* Dict with key/value pairs
*/
exports.configure = function (options) {
var settings = this.mergeWithDefaults(options);
if (device.platform == 'Android') {
cordova.exec(null, null, 'BackgroundMode', 'configure', [settings, true]);
}
};
/**
* If the mode is enabled or disabled.
*
* @return {Boolean}
*/
exports.isEnabled = function () {
return this._isEnabled;
};
/**
* If the mode is active.
*
* @return {Boolean}
*/
exports.isActive = function () {
return this._isActive;
};
/**
* Called when the background mode has been activated.
*/
exports.onactivate = function () {};
/**
* Called when the background mode has been deaktivated.
*/
exports.ondeactivate = function () {};
/**
* Called when the background mode could not been activated.
*
* @param {Integer} errorCode
* Error code which describes the error
*/
exports.onfailure = function () {};
/**
* @private
*
* Merge settings with default values.
*
* @param {Object} options
* The custom options
*
* @return {Object}
* Default values merged
* with custom values
*/
exports.mergeWithDefaults = function (options) {
var defaults = this.getDefaults();
for (var key in defaults) {
if (!options.hasOwnProperty(key)) {
options[key] = defaults[key];
continue;
}
}
return options;
};
});
......@@ -13,14 +13,6 @@
"count": 1
},
{
"xml": "<feature name=\"BackgroundMode\"><param name=\"android-package\" value=\"de.appplant.cordova.plugin.background.BackgroundMode\" /></feature>",
"count": 1
},
{
"xml": "<preference name=\"KeepRunning\" value=\"true\" />",
"count": 1
},
{
"xml": "<feature name=\"Toast\"><param name=\"android-package\" value=\"nl.xservices.plugins.Toast\" /></feature>",
"count": 1
},
......@@ -35,10 +27,6 @@
"parents": {
"/manifest/application": [
{
"xml": "<service android:name=\"de.appplant.cordova.plugin.background.ForegroundService\" />",
"count": 1
},
{
"xml": "<receiver android:exported=\"false\" android:name=\"de.appplant.cordova.plugin.localnotification.TriggerReceiver\" />",
"count": 1
},
......@@ -78,9 +66,6 @@
}
},
"installed_plugins": {
"de.appplant.cordova.plugin.background-mode": {
"PACKAGE_NAME": "de.appplant.cordova.plugin.local_notification.example"
},
"nl.x-services.plugins.toast": {
"PACKAGE_NAME": "de.appplant.cordova.plugin.local_notification.example"
},
......
{"source":{"type":"local","path":"../cordova-plugin-background-mode/"}}
\ No newline at end of file
## ChangeLog
#### Version 0.6.2 (14.12.2014)
- [bugfix:] Type error
- [bugfix:] Wrong default values for `isEnabled` and `isActive`.
#### Version 0.6.1 (14.12.2014)
- [enhancement:] Set default settings through `setDefaults`.
- [enhancement:] New method `isEnabled` to receive if mode is enabled.
- [enhancement:] New method `isActive` to receive if mode is active.
- [bugfix:] Events caused thread collision.
#### Version 0.6.0 (14.12.2014)
- [feature:] Android support
- [feature:] Change Android notification through `configure`.
- [feature:] `onactivate`, `ondeactivate` and `onfailure` callbacks.
- [___change___:] Disabled by default
- [enhancement:] Get default settings through `getDefaults`.
- [enhancement:] iOS does not require user permissions, internet connection and geo location anymore.
#### Version 0.5.0 (13.02.2014)
- __retired__
#### Version 0.4.1 (13.02.2014)
- Release under the Apache 2.0 license.
- [enhancement:] Location tracking is only activated on WP8 if the location service is available.
- [bigfix:] Nullpointer exception on WP8.
#### Version 0.4.0 (10.10.2013)
- Added WP8 support<br>
The plugin turns the app into an location tracking app *(for the time it runs in the background)*.
#### Version 0.2.1 (09.10.2013)
- Added js interface to manually enable/disable the background mode.
#### Version 0.2.0 (08.10.2013)
- Added iOS (>= 5) support<br>
The plugin turns the app into an location tracking app for the time it runs in the background.
\ No newline at end of file
<p align="right">
<a href="https://github.com/katzer/cordova-plugin-background-mode/tree/example">EXAMPLE :point_right:</a>
</p>
Cordova Background Plug-in
==========================
[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].
### Local development environment
From master:
```bash
# ~~ from master branch ~~
cordova plugin add https://github.com/katzer/cordova-plugin-background-mode.git
```
from a local folder:
```bash
# ~~ local folder ~~
cordova plugin add de.appplant.cordova.plugin.background-mode --searchpath path
```
or to use the last stable version:
```bash
# ~~ stable version ~~
cordova plugin add de.appplant.cordova.plugin.background-mode@0.6.2
```
To remove the plug-in, run the following command:
```bash
cordova plugin rm de.appplant.cordova.plugin.background-mode
```
### PhoneGap Build
Add the following xml to your config.xml to always use the latest version of this plugin:
```xml
<gap:plugin name="de.appplant.cordova.plugin.background-mode" version="0.6.2" />
```
More informations can be found [here][PGB_plugin].
## ChangeLog
#### Version 0.6.2 (14.12.2014)
- [bugfix:] Type error
- [bugfix:] Wrong default values for `isEnabled` and `isActive`.
#### Version 0.6.1 (14.12.2014)
- [enhancement:] Set default settings through `setDefaults`.
- [enhancement:] New method `isEnabled` to receive if mode is enabled.
- [enhancement:] New method `isActive` to receive if mode is active.
- [bugfix:] Events caused thread collision.
#### Further informations
- The former `plugin.backgroundMode` namespace has been deprecated and will be removed with the next major release.
- See [CHANGELOG.md][changelog] to get the full changelog for the plugin.
#### Known issues
- Plug-in is broken on Windows Phone 8.1 platform.
## Usage
The plugin creates the object `cordova.plugins.backgroundMode` with the following methods:
1. [backgroundMode.enable][enable]
2. [backgroundMode.disable][disable]
3. [backgroundMode.isEnabled][is_enabled]
4. [backgroundMode.isActive][is_active]
5. [backgroundMode.getDefaults][android_specifics]
6. [backgroundMode.setDefaults][android_specifics]
7. [backgroundMode.configure][configure]
8. [backgroundMode.onactivate][onactivate]
9. [backgroundMode.ondeactivate][ondeactivate]
10. [backgroundMode.onfailure][onfailure]
### Plugin initialization
The plugin and its methods are not available before the *deviceready* event has been fired.
```javascript
document.addEventListener('deviceready', function () {
// cordova.plugins.backgroundMode is now available
}, false);
```
### Prevent the app from going to sleep in background
To prevent the app from being paused while in background, the `backroundMode.enable` interface has to be called.
#### Further informations
- The background mode will be activated once the app has entered the background and will be deactivated after the app has entered the foreground.
- To activate the background mode the app needs to be in foreground.
```javascript
cordova.plugins.backgroundMode.enable();
```
### Pause the app while in background
The background mode can be disabled through the `backgroundMode.disable` interface.
#### Further informations
- Once the background mode has been disabled, the app will be paused when in background.
```javascript
cordova.plugins.backgroundMode.disable();
```
### Receive if the background mode is enabled
The `backgroundMode.isEnabled` interface can be used to get the information if the background mode is enabled or disabled.
```javascript
cordova.plugins.backgroundMode.isEnabled(); // => boolean
```
### Receive if the background mode is active
The `backgroundMode.isActive` interface can be used to get the information if the background mode is active.
```javascript
cordova.plugins.backgroundMode.isActive(); // => boolean
```
### Get informed when the background mode has been activated
The `backgroundMode.onactivate` interface can be used to get notified when the background mode has been activated.
```javascript
cordova.plugins.backgroundMode.onactivate = function() {};
```
### Get informed when the background mode has been deactivated
The `backgroundMode.ondeactivate` interface can be used to get notified when the background mode has been deactivated.
#### Further informations
- Once the mode has been deactivated the app will be paused soon after the callback has been fired.
```javascript
cordova.plugins.backgroundMode.ondeactivate = function() {};
```
### Get informed when the background mode could not been activated
The `backgroundMode.onfailure` interface can be used to get notified when the background mode could not been activated.
The listener has to be a function and takes the following arguments:
- errorCode: Error code which describes the error
```javascript
cordova.plugins.backgroundMode.onfailure = function(errorCode) {};
```
## Examples
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.
```javascript
document.addEventListener('deviceready', function () {
// Android customization
cordova.plugins.backgroundMode.setDefaults({ text:'Doing heavy tasks.'});
// Enable background mode
cordova.plugins.backgroundMode.enable();
// Called when background mode has been activated
cordova.plugins.backgroundMode.onactivate = function () {
setTimeout(function () {
// Modify the currently displayed notification
cordova.plugins.backgroundMode.configure({
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].
© 2013-2014 appPlant UG, Inc. All rights reserved
[cordova]: https://cordova.apache.org
[CLI]: http://cordova.apache.org/docs/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface
[PGB]: http://docs.build.phonegap.com/en_US/index.html
[PGB_plugin]: https://build.phonegap.com/plugins/490
[changelog]: CHANGELOG.md
[enable]: #prevent-the-app-from-going-to-sleep-in-background
[disable]: #pause-the-app-while-in-background
[is_enabled]: #receive-if-the-background-mode-is-enabled
[is_active]: #receive-if-the-background-mode-is-active
[android_specifics]: #android-customization
[configure]: #modify-the-currently-displayed-notification
[onactivate]: #get-informed-when-the-background-mode-has-been-activated
[ondeactivate]: #get-informed-when-the-background-mode-has-been-deactivated
[onfailure]: #get-informed-when-the-background-mode-could-not-been-activated
[apache2_license]: http://opensource.org/licenses/Apache-2.0
[appplant]: http://appplant.de
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="de.appplant.cordova.plugin.background-mode"
version="0.6.2">
<name>BackgroundMode</name>
<description>
Cordova plugin to prevent the app from going to sleep in background.
</description>
<repo>https://github.com/katzer/cordova-plugin-background-mode.git</repo>
<keywords>appplant, background, ios, wp8, android</keywords>
<license>Apache 2.0</license>
<author>Sebastián Katzer</author>
<!-- dependencies -->
<dependency
id="org.apache.cordova.device"
url="https://github.com/apache/cordova-plugin-device" />
<!-- cordova -->
<engines>
<engine name="cordova" version=">=3.0.0" />
</engines>
<!-- js -->
<js-module src="www/background-mode.js" name="BackgroundMode">
<clobbers target="cordova.plugins.backgroundMode" />
<clobbers target="plugin.backgroundMode" />
</js-module>
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="BackgroundMode">
<param name="ios-package" value="APPBackgroundMode" />
</feature>
</config-file>
<!-- The app is able to run in background through audio mode -->
<config-file target="*-Info.plist" parent="UIBackgroundModes">
<array>
<string>audio</string>
</array>
</config-file>
<resource-file src="appbeep.wav" />
<header-file src="src/ios/APPBackgroundMode.h" />
<source-file src="src/ios/APPBackgroundMode.m" />
</platform>
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="BackgroundMode" >
<param name="android-package"
value="de.appplant.cordova.plugin.background.BackgroundMode"/>
</feature>
</config-file>
<config-file target="res/xml/config.xml" parent="/*">
<preference name="KeepRunning" value="true" />
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<!--
* Puts the service in a foreground state, where the system considers
* it to be something the user is actively aware of and thus not a
* candidate for killing when low on memory.
-->
<service android:name="de.appplant.cordova.plugin.background.ForegroundService" />
</config-file>
<source-file
src="src/android/BackgroundMode.java"
target-dir="src/de/appplant/cordova/plugin/background" />
<source-file
src="src/android/ForegroundService.java"
target-dir="src/de/appplant/cordova/plugin/background" />
</platform>
<!-- wp8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
<feature name="BackgroundMode">
<param name="wp-package" value="BackgroundMode" />
</feature>
</config-file>
<!-- The app is able to run in background through location-tracking mode -->
<config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Tasks/DefaultTask">
<BackgroundExecution>
<ExecutionType Name="LocationTracking" />
</BackgroundExecution>
</config-file>
<config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
<Capability Name="ID_CAP_LOCATION" />
</config-file>
<source-file src="src/wp8/BackgroundMode.cs" />
</platform>
</plugin>
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package de.appplant.cordova.plugin.background;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
public class BackgroundMode extends CordovaPlugin {
// Event types for callbacks
private enum Event {
ACTIVATE, DEACTIVATE, FAILURE
}
// Plugin namespace
private static final String JS_NAMESPACE = "cordova.plugins.backgroundMode";
// Flag indicates if the app is in background or foreground
private boolean inBackground = false;
// Flag indicates if the plugin is enabled or disabled
private boolean isDisabled = true;
// Flag indicates if the service is bind
private boolean isBind = false;
// Default settings for the notification
private static JSONObject defaultSettings = new JSONObject();
// Tmp config settings for the notification
private static JSONObject updateSettings;
// Used to (un)bind the service to with the activity
private final ServiceConnection connection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
// Nothing to do here
}
@Override
public void onServiceDisconnected(ComponentName name) {
// Nothing to do here
}
};
/**
* Executes the request.
*
* @param action The action to execute.
* @param args The exec() arguments.
* @param callback The callback context used when
* calling back into JavaScript.
*
* @return
* Returning false results in a "MethodNotFound" error.
*
* @throws JSONException
*/
@Override
public boolean execute (String action, JSONArray args,
CallbackContext callback) throws JSONException {
if (action.equalsIgnoreCase("configure")) {
JSONObject settings = args.getJSONObject(0);
boolean update = args.getBoolean(1);
if (update) {
setUpdateSettings(settings);
updateNotifcation();
} else {
setDefaultSettings(settings);
}
return true;
}
if (action.equalsIgnoreCase("enable")) {
enableMode();
return true;
}
if (action.equalsIgnoreCase("disable")) {
disableMode();
return true;
}
return false;
}
/**
* Called when the system is about to start resuming a previous activity.
*
* @param multitasking
* Flag indicating if multitasking is turned on for app
*/
@Override
public void onPause(boolean multitasking) {
super.onPause(multitasking);
inBackground = true;
startService();
}
/**
* Called when the activity will start interacting with the user.
*
* @param multitasking
* Flag indicating if multitasking is turned on for app
*/
@Override
public void onResume(boolean multitasking) {
super.onResume(multitasking);
inBackground = false;
stopService();
}
/**
* Called when the activity will be destroyed.
*/
@Override
public void onDestroy() {
super.onDestroy();
stopService();
}
/**
* Enable the background mode.
*/
private void enableMode() {
isDisabled = false;
if (inBackground) {
startService();
}
}
/**
* Disable the background mode.
*/
private void disableMode() {
stopService();
isDisabled = true;
}
/**
* Update the default settings for the notification.
*
* @param settings
* The new default settings
*/
private void setDefaultSettings(JSONObject settings) {
defaultSettings = settings;
}
/**
* Update the config settings for the notification.
*
* @param settings
* The tmp config settings
*/
private void setUpdateSettings(JSONObject settings) {
updateSettings = settings;
}
/**
* The settings for the new/updated notification.
*
* @return
* updateSettings if set or default settings
*/
protected static JSONObject getSettings() {
if (updateSettings != null)
return updateSettings;
return defaultSettings;
}
/**
* Called by ForegroundService to delete the update settings.
*/
protected static void deleteUpdateSettings() {
updateSettings = null;
}
/**
* Update the notification.
*/
private void updateNotifcation() {
if (isBind) {
stopService();
startService();
}
}
/**
* Bind the activity to a background service and put them into foreground
* state.
*/
private void startService() {
Activity context = cordova.getActivity();
Intent intent = new Intent(
context, ForegroundService.class);
if (isDisabled || isBind)
return;
try {
context.bindService(
intent, connection, Context.BIND_AUTO_CREATE);
fireEvent(Event.ACTIVATE, null);
context.startService(intent);
} catch (Exception e) {
fireEvent(Event.FAILURE, e.getMessage());
}
isBind = true;
}
/**
* Bind the activity to a background service and put them into foreground
* state.
*/
private void stopService() {
Activity context = cordova.getActivity();
Intent intent = new Intent(
context, ForegroundService.class);
if (!isBind)
return;
fireEvent(Event.DEACTIVATE, null);
context.unbindService(connection);
context.stopService(intent);
isBind = false;
}
/**
* Fire vent with some parameters inside the web view.
*
* @param event
* The name of the event
* @param params
* Optional arguments for the event
*/
private void fireEvent (Event event, String params) {
String eventName;
if (updateSettings != null && event != Event.FAILURE)
return;
switch (event) {
case ACTIVATE:
eventName = "activate"; break;
case DEACTIVATE:
eventName = "deactivate"; break;
default:
eventName = "failure";
}
String active = event == Event.ACTIVATE ? "true" : "false";
String flag = String.format("%s._isActive=%s;",
JS_NAMESPACE, active);
String fn = String.format("setTimeout('%s.on%s(%s)',0);",
JS_NAMESPACE, eventName, params);
final String js = flag + fn;
cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
webView.loadUrl("javascript:" + js);
}
});
}
}
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package de.appplant.cordova.plugin.background;
import java.util.Timer;
import java.util.TimerTask;
import org.json.JSONObject;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
/**
* Puts the service in a foreground state, where the system considers it to be
* something the user is actively aware of and thus not a candidate for killing
* when low on memory.
*/
public class ForegroundService extends Service {
// Fixed ID for the 'foreground' notification
private static final int NOTIFICATION_ID = -574543954;
// Scheduler to exec periodic tasks
final Timer scheduler = new Timer();
// Used to keep the app alive
TimerTask keepAliveTask;
/**
* Allow clients to call on to the service.
*/
@Override
public IBinder onBind (Intent intent) {
return null;
}
/**
* Put the service in a foreground state to prevent app from being killed
* by the OS.
*/
@Override
public void onCreate () {
super.onCreate();
keepAwake();
}
@Override
public void onDestroy() {
super.onDestroy();
sleepWell();
}
/**
* Put the service in a foreground state to prevent app from being killed
* by the OS.
*/
public void keepAwake() {
final Handler handler = new Handler();
startForeground(NOTIFICATION_ID, makeNotification());
BackgroundMode.deleteUpdateSettings();
keepAliveTask = new TimerTask() {
@Override
public void run() {
handler.post(new Runnable() {
@Override
public void run() {
// Nothing to do here
// Log.d("BackgroundMode", "" + new Date().getTime());
}
});
}
};
scheduler.schedule(keepAliveTask, 0, 1000);
}
/**
* Stop background mode.
*/
private void sleepWell() {
stopForeground(true);
keepAliveTask.cancel();
}
/**
* Create a notification as the visible part to be able to put the service
* in a foreground state.
*
* @return
* A local ongoing notification which pending intent is bound to the
* main activity.
*/
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
private Notification makeNotification() {
JSONObject settings = BackgroundMode.getSettings();
Context context = getApplicationContext();
String pkgName = context.getPackageName();
Intent intent = context.getPackageManager()
.getLaunchIntentForPackage(pkgName);
Notification.Builder notification = new Notification.Builder(context)
.setContentTitle(settings.optString("title", ""))
.setContentText(settings.optString("text", ""))
.setTicker(settings.optString("ticker", ""))
.setOngoing(true)
.setSmallIcon(getIconResId());
if (intent != null && settings.optBoolean("resume")) {
PendingIntent contentIntent = PendingIntent.getActivity(
context, NOTIFICATION_ID, intent, PendingIntent.FLAG_CANCEL_CURRENT);
notification.setContentIntent(contentIntent);
}
if (Build.VERSION.SDK_INT < 16) {
// Build notification for HoneyComb to ICS
return notification.getNotification();
} else {
// Notification for Jellybean and above
return notification.build();
}
}
/**
* Retrieves the resource ID of the app icon.
*
* @return
* The resource ID of the app icon
*/
private int getIconResId () {
Context context = getApplicationContext();
Resources res = context.getResources();
String pkgName = context.getPackageName();
int resId;
resId = res.getIdentifier("icon", "drawable", pkgName);
return resId;
}
}
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <Cordova/CDVPlugin.h>
@interface APPBackgroundMode : CDVPlugin {
AVAudioPlayer *audioPlayer;
BOOL enabled;
}
// Activate the background mode
- (void) enable:(CDVInvokedUrlCommand *)command;
// Deactivate the background mode
- (void) disable:(CDVInvokedUrlCommand *)command;
@end
\ No newline at end of file
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#import "APPBackgroundMode.h"
@implementation APPBackgroundMode
NSString *const kAPPBackgroundJsNamespace = @"cordova.plugins.backgroundMode";
NSString *const kAPPBackgroundEventActivate = @"activate";
NSString *const kAPPBackgroundEventDeactivate = @"deactivate";
NSString *const kAPPBackgroundEventFailure = @"failure";
#pragma mark -
#pragma mark Initialization methods
/**
* Initialize the plugin.
*/
- (void) pluginInitialize
{
[self disable:NULL];
[self configureAudioPlayer];
[self configureAudioSession];
[self observeLifeCycle];
}
/**
* Register the listener for pause and resume events.
*/
- (void) observeLifeCycle
{
NSNotificationCenter* listener = [NSNotificationCenter defaultCenter];
if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
[listener addObserver:self
selector:@selector(keepAwake)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
[listener addObserver:self
selector:@selector(stopKeepingAwake)
name:UIApplicationWillEnterForegroundNotification
object:nil];
[listener addObserver:self
selector:@selector(handleAudioSessionInterruption:)
name:AVAudioSessionInterruptionNotification
object:nil];
} else {
[self enable:NULL];
[self keepAwake];
}
}
#pragma mark -
#pragma mark Interface methods
/**
* Enable the mode to stay awake
* when switching to background for the next time.
*/
- (void) enable:(CDVInvokedUrlCommand *)command
{
enabled = YES;
}
/**
* Disable the background mode
* and stop being active in background.
*/
- (void) disable:(CDVInvokedUrlCommand *)command
{
enabled = NO;
[self stopKeepingAwake];
}
#pragma mark -
#pragma mark Core methods
/**
* Keep the app awake.
*/
- (void) keepAwake {
if (enabled) {
[audioPlayer play];
[self fireEvent:kAPPBackgroundEventActivate withParams:NULL];
}
}
/**
* Let the app going to sleep.
*/
- (void) stopKeepingAwake {
if (TARGET_IPHONE_SIMULATOR) {
NSLog(@"BackgroundMode: On simulator apps never pause in background!");
}
if (audioPlayer.isPlaying) {
[self fireEvent:kAPPBackgroundEventDeactivate withParams:NULL];
}
[audioPlayer pause];
}
/**
* Configure the audio player.
*/
- (void) configureAudioPlayer {
NSString* path = [[NSBundle mainBundle] pathForResource:@"appbeep"
ofType:@"wav"];
NSURL* url = [NSURL fileURLWithPath:path];
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url
error:NULL];
// Silent
audioPlayer.volume = 0;
// Infinite
audioPlayer.numberOfLoops = -1;
};
/**
* Configure the audio session.
*/
- (void) configureAudioSession {
AVAudioSession* session = [AVAudioSession
sharedInstance];
// Play music even in background and dont stop playing music
// even another app starts playing sound
[session setCategory:AVAudioSessionCategoryPlayback
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:NULL];
[session setActive:YES error:NULL];
};
#pragma mark -
#pragma mark Helper methods
/**
* Restart playing sound when interrupted by phone calls.
*/
- (void) handleAudioSessionInterruption:(NSNotification*)notification {
[self fireEvent:kAPPBackgroundEventDeactivate withParams:NULL];
[self keepAwake];
}
/**
* Method to fire an event with some parameters in the browser.
*/
- (void) fireEvent:(NSString*)event withParams:(NSString*)params
{
NSString* active = [event isEqualToString:kAPPBackgroundEventActivate] ? @"true" : @"false";
NSString* flag = [NSString stringWithFormat:@"%@._isActive=%@;",
kAPPBackgroundJsNamespace, active];
NSString* fn = [NSString stringWithFormat:@"setTimeout('%@.on%@(%@)',0);",
kAPPBackgroundJsNamespace, event, params];
NSString* js = [flag stringByAppendingString:fn];
[self.commandDelegate evalJs:js];
}
@end
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
using WPCordovaClassLib.Cordova.Commands;
using Windows.Devices.Geolocation;
using Microsoft.Phone.Shell;
using System;
using WPCordovaClassLib.Cordova;
namespace Cordova.Extension.Commands
{
/// </summary>
/// Ermöglicht, dass eine Anwendung im Hintergrund läuft ohne pausiert zu werden
/// </summary>
public class BackgroundMode : BaseCommand
{
/// </summary>
/// Event types for callbacks
/// </summary>
enum Event {
ACTIVATE, DEACTIVATE, FAILURE
}
#region Instance variables
/// </summary>
/// Flag indicates if the plugin is enabled or disabled
/// </summary>
private bool IsDisabled = true;
/// </summary>
/// Geolocator to monitor location changes
/// </summary>
private static Geolocator Geolocator { get; set; }
#endregion
#region Interface methods
/// </summary>
/// Enable the mode to stay awake when switching
/// to background for the next time.
/// </summary>
public void enable (string args)
{
IsDisabled = false;
}
/// </summary>
/// Disable the background mode and stop
/// being active in background.
/// </summary>
public void disable (string args)
{
IsDisabled = true;
Deactivate();
}
#endregion
#region Core methods
/// </summary>
/// Keep the app awake by tracking
/// for position changes.
/// </summary>
private void Activate()
{
if (IsDisabled || Geolocator != null)
return;
if (!IsServiceAvailable())
{
FireEvent(Event.FAILURE, null);
return;
}
Geolocator = new Geolocator();
Geolocator.DesiredAccuracy = PositionAccuracy.Default;
Geolocator.MovementThreshold = 100000;
Geolocator.PositionChanged += geolocator_PositionChanged;
FireEvent(Event.ACTIVATE, null);
}
/// </summary>
/// Let the app going to sleep.
/// </summary>
private void Deactivate ()
{
if (Geolocator == null)
return;
FireEvent(Event.DEACTIVATE, null);
Geolocator.PositionChanged -= geolocator_PositionChanged;
Geolocator = null;
}
#endregion
#region Helper methods
/// </summary>
/// Determine if location service is available and enabled.
/// </summary>
private bool IsServiceAvailable()
{
Geolocator geolocator = (Geolocator == null) ? new Geolocator() : Geolocator;
PositionStatus status = geolocator.LocationStatus;
if (status == PositionStatus.Disabled)
return false;
if (status == PositionStatus.NotAvailable)
return false;
return true;
}
/// <summary>
/// Fires the given event.
/// </summary>
private void FireEvent(Event Event, string Param)
{
string EventName;
switch (Event) {
case Event.ACTIVATE:
EventName = "activate"; break;
case Event.DEACTIVATE:
EventName = "deactivate"; break;
default:
EventName = "failure"; break;
}
string js = String.Format("cordova.plugins.backgroundMode.on{0}({1})", EventName, Param);
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, js);
pluginResult.KeepCallback = true;
DispatchCommandResult(pluginResult);
}
#endregion
#region Delegate methods
private void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
// Nothing to do here
}
#endregion
#region Lifecycle methods
/// <summary>
/// Occurs when the application is being deactivated.
/// </summary>
public override void OnPause(object sender, DeactivatedEventArgs e)
{
Activate();
}
/// <summary>
/// Occurs when the application is being made active after previously being put
/// into a dormant state or tombstoned.
/// </summary>
public override void OnResume(object sender, ActivatedEventArgs e)
{
Deactivate();
}
#endregion
}
}
/*
Copyright 2013-2014 appPlant UG
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var exec = require('cordova/exec'),
channel = require('cordova/channel');
// Override back button action to prevent being killed
document.addEventListener('backbutton', function () {}, false);
// Called before 'deviceready' listener will be called
channel.onCordovaReady.subscribe(function () {
// Device plugin is ready now
channel.onCordovaInfoReady.subscribe(function () {
// Set the defaults
exports.setDefaults({});
});
// Only enable WP8 by default
if (['WinCE', 'Win32NT'].indexOf(device.platform) > -1) {
exports.enable();
}
});
/**
* @private
*
* Flag indicated if the mode is enabled.
*/
exports._isEnabled = false;
/**
* @private
*
* Flag indicated if the mode is active.
*/
exports._isActive = false;
/**
* @private
*
* Default values of all available options.
*/
exports._defaults = {
title: 'App is running in background',
text: 'Doing heavy tasks.',
ticker: 'App is running in background',
resume: true
};
/**
* Activates the background mode. When activated the application
* will be prevented from going to sleep while in background
* for the next time.
*/
exports.enable = function () {
this._isEnabled = true;
cordova.exec(null, null, 'BackgroundMode', 'enable', []);
};
/**
* Deactivates the background mode. When deactivated the application
* will not stay awake while in background.
*/
exports.disable = function () {
this._isEnabled = false;
cordova.exec(null, null, 'BackgroundMode', 'disable', []);
};
/**
* List of all available options with their default value.
*
* @return {Object}
*/
exports.getDefaults = function () {
return this._defaults;
};
/**
* Overwrite default settings
*
* @param {Object} overrides
* Dict of options which shall be overridden
*/
exports.setDefaults = function (overrides) {
var defaults = this.getDefaults();
for (var key in defaults) {
if (overrides.hasOwnProperty(key)) {
defaults[key] = overrides[key];
}
}
if (device.platform == 'Android') {
cordova.exec(null, null, 'BackgroundMode', 'configure', [defaults, false]);
}
};
/**
* Configures the notification settings for Android.
* Will be merged with the defaults.
*
* @param {Object} options
* Dict with key/value pairs
*/
exports.configure = function (options) {
var settings = this.mergeWithDefaults(options);
if (device.platform == 'Android') {
cordova.exec(null, null, 'BackgroundMode', 'configure', [settings, true]);
}
};
/**
* If the mode is enabled or disabled.
*
* @return {Boolean}
*/
exports.isEnabled = function () {
return this._isEnabled;
};
/**
* If the mode is active.
*
* @return {Boolean}
*/
exports.isActive = function () {
return this._isActive;
};
/**
* Called when the background mode has been activated.
*/
exports.onactivate = function () {};
/**
* Called when the background mode has been deaktivated.
*/
exports.ondeactivate = function () {};
/**
* Called when the background mode could not been activated.
*
* @param {Integer} errorCode
* Error code which describes the error
*/
exports.onfailure = function () {};
/**
* @private
*
* Merge settings with default values.
*
* @param {Object} options
* The custom options
*
* @return {Object}
* Default values merged
* with custom values
*/
exports.mergeWithDefaults = function (options) {
var defaults = this.getDefaults();
for (var key in defaults) {
if (!options.hasOwnProperty(key)) {
options[key] = defaults[key];
continue;
}
}
return options;
};
......@@ -13,10 +13,6 @@
"count": 1
},
{
"xml": "<feature name=\"BackgroundMode\"><param name=\"ios-package\" value=\"APPBackgroundMode\" /></feature>",
"count": 1
},
{
"xml": "<feature name=\"Toast\"><param name=\"ios-package\" value=\"Toast\" /></feature>",
"count": 1
},
......@@ -29,12 +25,7 @@
},
"*-Info.plist": {
"parents": {
"UIBackgroundModes": [
{
"xml": "<array><string>audio</string></array>",
"count": 1
}
]
"UIBackgroundModes": []
}
},
"framework": {
......@@ -50,9 +41,6 @@
}
},
"installed_plugins": {
"de.appplant.cordova.plugin.background-mode": {
"PACKAGE_NAME": "de.appplant.cordova.plugin.local-notification.example"
},
"nl.x-services.plugins.toast": {
"PACKAGE_NAME": "de.appplant.cordova.plugin.local-notification.example"
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment