Giter Site home page Giter Site logo

katzer / cordova-plugin-background-mode Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 998.0 11.23 MB

Keep app running in background

License: Apache License 2.0

Java 54.71% Objective-C 25.55% JavaScript 19.75%
android appplant background cordova infinite ios windows-uwp

cordova-plugin-background-mode's People

Contributors

chanhyuk-im avatar chpecson avatar christophersax-at avatar danielriera avatar dimitriscsd avatar ihadeed avatar jerodfritz avatar katzer avatar mdailor avatar perrin4869 avatar pknittel avatar rtbm avatar siebmanb avatar soramister avatar steedems avatar thibaudd avatar tushe avatar woutwo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-background-mode's Issues

How can i tell if its working?

Am very interested in this plugin cause am using pusher for my app and after a while android just kills my connection to the server. Setting my app as a background service will solve this problem, so i just wanted to know how do i know if my app is running as a background service?

Scheduling restart of crashed ForegroundService?

I'm using this in an enterprise android app that is deployed only through hockeyapp. I've been using it for about 2 months and getting pretty good results, however I am running in to some problems.

When the phone is getting only light use, this plugin appears to do the trick and the app will remain running for days. However, if I move away from the app, launch chrome, and then visit maps.google.com then I can consistently break it.

Here is what i do:

  1. Launch my app and call window.plugin.backgroundMode.enable().
  2. Move away from the app. My callback for onactivate is called and I see the notification banner that my app is still running.
  3. Launch chrome, open maps.google.com. Wait for the entire page to load. At this point, my app is no longer running.

The notification banner is still up, but now it is missing the text. Tapping on the notification banner does nothing. My app is still listed in the recent apps list, but it is not running. If I tap on the app from the recent apps list, then my app opens and restarts, but the notification banner is still not working. I must exit the app and restart to get back in to a proper state.

I've been attempting to debug this with ddms, but I'm I don't know what to look for. I see this whenever the error occurs, but nothing else from the logs is jumping out at me.

01-06 14:57:55.992: I/NotificationMonitorService(1420): ID :-574543954  Relay is still running  com.deliveryrelay.rider
01-06 14:58:11.127: I/ActivityManager(914): Process com.deliveryrelay.rider (pid 14369) has died.
01-06 14:58:11.127: I/WindowState(914): WIN DEATH: Window{43e585b0 u0 com.deliveryrelay.rider/com.deliveryrelay.rider.CordovaApp}
01-06 14:58:11.131: W/ActivityManager(914): Scheduling restart of crashed service com.deliveryrelay.rider/de.appplant.cordova.plugin.background.ForegroundService in 18527ms
01-06 14:58:11.148: I/NotificationMonitorService(1420): ID :-574543954  Relay is still running  com.deliveryrelay.rider
01-06 14:58:21.198: A/ProcessStats(914): Starting service ServiceState{437e9920 de.appplant.cordova.plugin.background.ForegroundService pkg=com.deliveryrelay.rider proc=437e9920} without owner
01-06 14:58:21.336: A/ProcessStats(914): Starting service ServiceState{437e9920 de.appplant.cordova.plugin.background.ForegroundService pkg=com.deliveryrelay.rider proc=437e9920} without owner
01-06 14:58:21.929: A/ProcessStats(914): Starting service ServiceState{437e9920 de.appplant.cordova.plugin.background.ForegroundService pkg=com.deliveryrelay.rider proc=437e9920} without owner
01-06 14:58:22.112: A/ProcessStats(914): Starting service ServiceState{437e9920 de.appplant.cordova.plugin.background.ForegroundService pkg=com.deliveryrelay.rider proc=437e9920} without owner
01-06 14:58:22.447: A/ProcessStats(914): Starting service ServiceState{437e9920 de.appplant.cordova.plugin.background.ForegroundService pkg=com.deliveryrelay.rider proc=437e9920} without owner

I'm on version 0.6.2 and the OS is 4.4.2, but I've seen this on a couple of differen OS versions.

Here is what the notification looks like after an error:
image

Dont' work in Phonegap 3.4

You can help send me a example of the plugin de.appplant.cordova.plugin.background-mode with phonegap 3.4, because don't work and maybe my implementation is wrong.

Error building for iOS from Phonegap Build

Hi,
The plugin page doesn't state any special requirement but it doesn't compile in phonegap build. I tried to compile from Xcode and got the same error. I'm new to iOS dev but I fixed it by adding CoreLocation framework as a dependency on the linking process. Why is it necessary and why isn't this stated in the readme page? Is there a way to solve this "manual" dependency?

Here's the offending part in the build process of Phonegap Build

Ld build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7/DentanumTestApp normal armv7
    cd /project
    export IPHONEOS_DEPLOYMENT_TARGET=6.0
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -L/project/build -F/project/build -filelist /project/build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7/DentanumTestApp.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /project/build/libCordova.a -ObjC -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework AssetsLibrary /project/build/libCordova.a -framework CoreGraphics -framework MobileCoreServices -Xlinker -dependency_info -Xlinker /project/build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7/DentanumTestApp_dependency_info.dat -o /project/build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7/DentanumTestApp
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_CLLocationManager", referenced from:
      objc-class-ref in APPBackgroundMode.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ld build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7s/DentanumTestApp normal armv7s
    cd /project
    export IPHONEOS_DEPLOYMENT_TARGET=6.0
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -L/project/build -F/project/build -filelist /project/build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7s/DentanumTestApp.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /project/build/libCordova.a -ObjC -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework AssetsLibrary /project/build/libCordova.a -framework CoreGraphics -framework MobileCoreServices -Xlinker -dependency_info -Xlinker /project/build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7s/DentanumTestApp_dependency_info.dat -o /project/build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7s/DentanumTestApp
Undefined symbols for architecture armv7s:
  "_OBJC_CLASS_$_CLLocationManager", referenced from:
      objc-class-ref in APPBackgroundMode.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **


The following build commands failed:
    Ld build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7/DentanumTestApp normal armv7
    Ld build/DentanumTestApp.build/Release-iphoneos/DentanumTestApp.build/Objects-normal/armv7s/DentanumTestApp normal armv7s
(2 failures)

cordova plugin add @0.6.2: version not found

When running the command "cordova plugin add de.appplant.cordova.plugin.background-mode@
0.6.2", I get this result:

Fetching plugin "[email protected]" via plugin registry
npm http GET http://registry.cordova.io/de.appplant.cordova.plugin.background-mode/0.6.2
npm http 404 http://registry.cordova.io/de.appplant.cordova.plugin.background-mode/0.6.2
Error: version not found: 0.6.2 : de.appplant.cordova.plugin.background-mode/0.6.2

Maybe some file is missing from the server? When installing without @0.6.2, version 0.6.1 is downloaded.

notification with background mode ios/android

I am using both of your plugins - notification and background mode. Now the thing is whenever the notification shows up and I select it, it does do whatever it's programmed to do once I click on it and the app is in background at the time. Now if I take app of from background from doing double click on ios (showing app list and all)and afterwards when notification shows up, it doesn't do whatever it was programmed to do (after launching the app). I believe the id that gets passed is being forgotten when I take it off the background. Is this how this works or there is a work around to this?

thanks

plugin not being installed properly on Android?

Hi,
I installed the plugin using "cordova plugin add" (cordova 3.3.1) but I get following error in eclipse when I run the app on Android:

D/PluginManager(7193): exec() call to unknown plugin: BackgroundMode

I noticed that there are no java files installed in the src directory.
I believe something goes wrong during the cordova plugin add command.
Any ideas?

Background mode does not work under WP8 with each app

After installing the plugin, the maintcall app works fine in background but an empty-initial cordova app does not run in background.

Maybe there are some hidden constraints or requirements which needs to be added to the plugin?

Android supported?

The readme says android is supported, but there is no android directory in the src directory. Does that make sense?

Error when using on Android 2.3

Hi,

I'm now developing an Android app that needs background service with this plugin, however, it refuses to work when the screen is off on my Android 2.3 (Force Close), and complains in logcat:

E/dalvikvm( 2129): Could not find class 'android.app.Notification$Builder', referenced from method de.appplant.cordova.plugin.background.ForegroundService.makeNotification
W/dalvikvm( 2129): VFY: unable to resolve new-instance 14 (Landroid/app/Notification$Builder;) in Lde/appplant/cordova/plugin/background/ForegroundService;

Is it possible to fix it? Thanks.

AppStore compliance

Hi,

I was wondering if your plugin is AppStore compliant. Have you successfully released an app on the AppStore using it?

If you did, is there anything I should do to make sure it is accepted?

Thanks

Default overrides my custom settings

Problem:

Default title, text and ticker overrides my custom settings on Android


I have done some testing to debug the error

background-mode.js (from line 98) (Please note that I added one line ^o^ )

[...]
exports.mergeWithDefaults = function (options) {
    var defaults = this.getDefaults();

    for (var key in defaults) {
        if (!options.hasOwnProperty(key)) {
            options[key] = defaults[key];
            continue;
        }
    }
    alert(options["title"]);  /***** PLEASE NOTICE: I put this line to debug *****/
    return options;
};

index.html (fragment)

[...]
    document.addEventListener("deviceready", function () {

         cordova.plugins.backgroundMode.enable();
         cordova.plugins.backgroundMode.configure({
            title:  "Sigue activo",
            text:   "Ejecutando ",
            ticker: "Sigue activo",
            resume: false
        });


    });
[...]

When I open the application I get two alerts

First alert: (This is triggered by my index.html)

Alert
    Sigue activo
[OK]

Second alert: (This is triggered by line 31 of background-mode.js)

Alert
    App is running in background
[OK]

Dirty solution

index.html (fragment)
Is to force my configuracion to run after exports.configure(); is fired with a setTimeout()

[...]

    document.addEventListener("deviceready", function () {
     setTimeout(function(){
         cordova.plugins.backgroundMode.enable();
         cordova.plugins.backgroundMode.configure({
            title:  "Sigue activo",
            text:   "Ejecutando Offline",
            ticker: "Sigue activo",
            resume: false
        });

       },10000);
    });
[...]

Clever posible solution

fix the null argument of background-mode.js (line 31)

exports.configure();

Some links with same problem

#39
#40

Geolocation request message

Hello. When my app starts firstly, i see this message (see screenshot). It's text message isn't standart. How can i delete lines "Is reuqired -for IOS6 and above- to run this app in background!".
P.S. Geolocation is using by my app.
screenshot

Android Phonegap 3.3 app background mode inconsistent

I have an Android PG 3.3 app that adds 7 notifications to take a survey in a day for two days at time (using your local notification plug-in :) ) I need the notifications to fire a local audio file ontrigger and then cancel the audio and cancel the notification after three minutes... I achieve this with java script code:

window.plugin.notification.local.ontrigger = function (id, state, json) {

    playNotificationAudio();

    setTimeout(function(){
                    window.plugin.notification.local.cancel(id);
            }, (180 * 1000));
        };

window.plugin.notification.local.oncancel = function (id, state, json) {
                if(my_media){
                    my_media.stop();
                    my_media.release();
                }
        };

This works perfectly when I am debugging the application within Eclipse, however, it seems like as time goes on the background mode fails to enable or stay enabled reliably, resulting in odd behavior. My notifications will sometimes not not fire their sounds until I activate the device. I will receive stacks of notifications from long ago even though they should have cancelled 3 minutes after triggering (In one instance, I had 6 notifications in my notification bar that vanished all at once after a couple of minutes of me bringing the phone from sleep). Sometimes I will also get weird laggy responses in which the application will almost freeze for a few seconds before allowing interaction/

Maybe I am not enabling the plugin correctly, but it seems to work for the most part (while debugging in Eclipse and for a short while after) and makes sense to me to implement the plugin in this way, according to this plugin's documents. Here is how I enable the plugin (enabled upon a user pausing the application from Phonegap's onPause event):

document.addEventListener("pause", userHasGoneIdle , false);

function userHasGoneIdle(){
    window.plugin.backgroundMode.enable();
    ...

I do not disable the backgroundMode as the docs say that it will disable upon coming to the foreground.

Any ideas on how to solve this issue? My only other option(that I can see) is to use another background plugin such as: https://github.com/Red-Folder/Cordova-Plugin-BackgroundService

However, implementing the background service in this way sounds daunting for someone with zero Android programming experience.

Any Advice?

iOS 8 geolocation warning shows even when no GPS watch active

The new iOS 8 blue bar that says "SomeApp is Using Your Location" shows up even if location tracking is not running if it was running at some point in the background in the past.

Gist here: https://gist.github.com/levic/6a5d4b9c1b6ea1fcd147

Steps to replicate:

  • Tap Start. GPS tracking starts.
  • Tap Stop. GPS tracking stops.
  • Tap Home Button. No warning bar displayed.
  • Return to app
  • Tap Start. GPS tracking starts.
  • Tap Home Button. Blue iOS 8 location warning bar shows. This is expected as GPS is still running.
  • Return to app
  • Tap Stop. GPS tracking stops.
  • Tap Home Button
  • Blue iOS 8 location warning bar should not show, as there is no GPS tracking active. Instead, if at any time in the past the cordova app used the GPS in the background, the blue bar will always show until the app is terminated.

This occurs on iOS 8 if an app's location services setting is set to "While Using" (doesn't happen if is set to "Always").

Tested with

  • Cordova 4.1.2
  • de.appplant.cordova.plugin.background-mode 0.5.0 "BackgroundMode"
  • org.apache.cordova.device 0.2.12 "Device"
  • org.apache.cordova.geolocation 0.3.10 "Geolocation"

It seems possible that this could in fact be a bug with cordova geolocation itself assuming it won't ever run in the background, but there was nothing obvious in CDVLocation.m.

Errors running with this plugin

On android with latest ionic framework :

I'm trying to use this plugin, so far it does keep the app running in background but I get errors when i try to call window.plugin.backgroundMode.disable();

(or enable() or configure()... )

I get: Service not Registered: de.appplant.cordova.plugin.background.BackgroundMode

How to run plugin with android

Hi, I'd like to know how to run this plugin with android.
I've been looking for android code but I can't find anything.
I'm new with Github, but I followed all the steps to install the plugin and there's nothing in src folder to execute the cordova.exec calls.
Also I'm trying to run javascript code as a service, is it possible with this plugin?
Can you help me?

Thank you.

Android

Does android have it's on built in way to do this or are you missing the Java source files?

.disable not working when in background on iOS

Good day,
iOS version: 7.1.2
Phonegap version: 3.3

I'm not able to experience the following behaviour:
"If the mode is disabled while the app is running in the background, the app will be paused immediately."

It seems that when the application is running in the background, the .disable command will not disable the background mode and the app keeps running infinitely.

If I run .disable when the app is running in the foreground, the background mode will disable successfuly.

If there is any other information needed, please let me know.

Thanks for the plugin

What I"m doing wrong?

I would like to greet the contributors of this plugin - Thanks!!!

I have implemented the plugin in my project but I don't see any change in the behave.

function onDeviceReady() {
    if (window.plugin.backgroundMode){
        alert ("InX enableBackground");
        window.plugin.backgroundMode.disable();

// OR window.plugin.backgroundMode.enable();
alert ("AfterX enableBackground");
}
// Throw an error if no update is received every 30 seconds
var options = { timeout: 30000 };
watchID = navigator.geolocation.watchPosition(onSuccess, onError, options);
}

What I"m doing wrong?

Thanks in advance,
Yair

Add background fetch for iOS

I would like to use the more open Background Fetch option for iOS 7. This avoids the issues of needing to use location data, but at the cost of not getting notified as much which is acceptable. Is there any chance you would be willing to extend this plugin to give us the option to use Background Fetching versus Location?

Here is an idea of how I'd like to see it work.
Instead of :
window.plugin.backgroundMode.enable();
How about:

window.plugin.backgroundMode.backgroundFetch(function(state) {
if (state === 'background-fetch') {
//do limited work, wait for next call back
} else if (state === 'background') //non-iOS7 methods
//this code launches timers, etc because I'll handle how often I need process power
}
});

I hope you like the idea. Thanks.

rejected by the AppStore

hi @katzer
I use your plugin very well
when I submit to the AppStore,but reject ...

I search for it
https://github.com/katzer/cordova-plugin-background-mode

AppStore
Warning: if you use this plugin but your app does not require any persistent geolocation (eg you do nothing with the geolocation values), your app will be rejected by the AppStore review team (there is at least one predecedent).

well...I just want to ask you
how to fix it ? through the "info.plist" or others way ?

Please tell me something about the plug-in can be done ?

I am in Android 4.0.3

Please tell me something about the plug-in can be done ?
here is my sample code

function checkBackgroundMode(action) 
{
 if(action == '1')
 {
 window.plugin.backgroundMode.enable();
 setInterval(function() { alert("every ten seconds do again"); }, 10000);
 }
 if(action == '0')
 {
 window.plugin.backgroundMode.disable();
 }
}

when I use action (1),no mater when I on which page (index.html or xxx.html),it will alert "every ten seconds do again" message every ten seconds

but Even I use action (0),it still alert "every ten seconds do again" message every ten seconds (I think if I stop the background mode,it should be stop all function with background mode,right ?)

If I misunderstood the true meaning of this plug-in,please tell me,tls~

No location update on real iOS 7 device

I want to use your plugin to enable tracking of a device in the background.

It works fine in the iOS Simulator (I can send it to the background and it still tracks the users position, I can see it in the logs).

But when I deploy it to a test device (iPhone 4s, latest iOS installed) the background location tracking is not working, the GPS-tracking switches off (I can see it because the GPS arrow is removed from the statusbar.

Any ideas how to fix this?

Thanks!

Sample app for Background service and local notification

This is a great plugin. Thanks to the contributors!!

I am new to Cordova and I have one requirement in which there will be one service which will run in background. It will make a call to server once every 24 hours and if it founds any data then it will create a local notification by Displaying an alert on banner, Badging the app’s icon and Playing a sound. otherwise sleeps for next 24 hours. If user taps on banner or app then that notification should go away.

I am not able to find much samples on web. Can you please provide some help links or samples if you have having similar requirements.

Configure don't make change!

Hi katzer,
When i use "backgroundMode.configure..." for customizes my notification, there is no change on the display, this function it's already implemented in the latest version 0.6.0-dev?

regards

Stop background mode after a few hours

Hi, I just found this issue when I try to fetch some SMS during my app in background mode. After a few of hours it seems disable the background mode. Why?

Background notification dissappears before confirming

la foto
Hi there,

Sometimes when I minimize my application, the iOS location service warning pops but closes immediately, and sometimes when I maximize the application the warning appears and I can't do anything until I accept or decline, I can't even minimize it again or go to home page, which is an inconsistent behavior compared to the standard iOS one.

Do I need to do any specific workaround for iOS? I've used this plugin in android before and I don't remember I had to initialize the background mode or something to make it work.

Thanks

Adding plugin corrupted my app build

I added this plugin to my Android build. I am using Phonegap 3.4.0. After adding the plugin - following any caveats in the documentation, building Android, and running Android, my app no longer worked. It would crash and spit out a few errors in the console

D/CordovaLog(11912): file:///android_asset/www/index.html: Line 25 : Viewport target-densitydpi is not supported.
D/CordovaLog(11912): file:///android_asset/www/js/index.js: Line 36 : user ID = 9122
D/CordovaLog(11912): file:///android_asset/www/cordova.js: Line 1128 : deviceready has not fired after 5 seconds.
D/CordovaLog(11912): file:///android_asset/www/cordova.js: Line 1121 : Channel not fired: onFileSystemPathsReady

I tried reverting and removing the plugin, but the build was corrupt. I had to rebuild and copy my code over to restore my project.

Something not working with Android 4.1.2 and phonegap 3.5.0

Hi, thanks for the plugin and specially the support. I'm using Android 4.1.2, the pushplugin, the local-notification and this background-mode plugin which I called with window.plugin.backgroundMode.enable(); at the onDeviceReady() event, yet when the app is minimized nothing keeps working. I even added the KeepRunning=true attribute to my config.xml, but everything is pointless, push notifications are silently ignored when the app is minimized. Is there something else to try? Thanks in advance.

PS. I can send small PayPal donation in exchange for help that makes it work, please add paypal address if you want, thanks

'backgroundMode' of undefined

I implement cordova plugin background mode, I do following step
cordova add plugin ....
import background-mode.js at index html
File app.js
add + window.plugin.backgroundMode.enable();
$ionicPlatform.ready(function() {
......
window.plugin.backgroundMode.enable();
});
But when run ionic serve, I got error Cannot read property 'backgroundMode' of undefined
Tell me where I go wrong, thanks ( cordova 3.5)

Audio on iOS pauses

When playing an audio file using phonegap plugin that app pauses the audio stream. I was hoping that adding your plugin would prevent that. It doesnt. is this a bug or a feature you dont support?

background service is stopped working when new notification from background is added.

Hi,

I am using

katzer/cordova-plugin-local-notifications
and

katzer/cordova-plugin-background-mode
But background service is using Foreground Notification and when my application goes in background and it receives any request from server it is producing a notification which clashes with the foreground Notification and my service stopped working.

i am using the following code for notification but LED is not showing any color.

window.plugin.notification.local.add({ led: 'A0FF05' });
also when my application goes on pause the background service is starting with huge error

12-23 13:54:08.180: E/ActivityThread(15572): Activity com.example.test.CordovaApp has leaked ServiceConnection de.appplant.cordova.plugin.background.BackgroundMode$1@426a9df8 that was originally bound here
12-23 13:54:08.180: E/ActivityThread(15572): android.app.ServiceConnectionLeaked: Activity com.example.test.CordovaApp has leaked ServiceConnection de.appplant.cordova.plugin.background.BackgroundMode$1@426a9df8 that was originally bound here
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:965)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:859)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.ContextImpl.bindService(ContextImpl.java:1344)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.ContextImpl.bindService(ContextImpl.java:1336)
12-23 13:54:08.180: E/ActivityThread(15572): at android.content.ContextWrapper.bindService(ContextWrapper.java:401)
12-23 13:54:08.180: E/ActivityThread(15572): at de.appplant.cordova.plugin.background.BackgroundMode.startService(BackgroundMode.java:241)
12-23 13:54:08.180: E/ActivityThread(15572): at de.appplant.cordova.plugin.background.BackgroundMode.onDestroy(BackgroundMode.java:154)
12-23 13:54:08.180: E/ActivityThread(15572): at org.apache.cordova.PluginManager.onDestroy(PluginManager.java:255)
12-23 13:54:08.180: E/ActivityThread(15572): at org.apache.cordova.CordovaWebView.handleDestroy(CordovaWebView.java:794)
12-23 13:54:08.180: E/ActivityThread(15572): at org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:649)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.Activity.performDestroy(Activity.java:5370)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1113)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3301)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3332)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.ActivityThread.access$1200(ActivityThread.java:140)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
12-23 13:54:08.180: E/ActivityThread(15572): at android.os.Handler.dispatchMessage(Handler.java:99)
12-23 13:54:08.180: E/ActivityThread(15572): at android.os.Looper.loop(Looper.java:137)
12-23 13:54:08.180: E/ActivityThread(15572): at android.app.ActivityThread.main(ActivityThread.java:4898)
12-23 13:54:08.180: E/ActivityThread(15572): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 13:54:08.180: E/ActivityThread(15572): at java.lang.reflect.Method.invoke(Method.java:511)
12-23 13:54:08.180: E/ActivityThread(15572): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-23 13:54:08.180: E/ActivityThread(15572): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-23 13:54:08.180: E/ActivityThread(15572): at dalvik.system.NativeStart.main(Native Method)
Please tell me the solution for running application as a background service but without any foreground service or notification

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.