Giter Club home page Giter Club logo

Comments (12)

drakula84 avatar drakula84 commented on May 31, 2024 1

Thanks @christocracy - I am looking into https://github.com/Red-Folder/bgs-core/wiki/Build-your-own-Background-Service to implement the background service. However, this plugin is Android only. I will need to look for iOS one too.

Thanks for the clarification, however, I struggle to understand the purpose of cordova-plugin-background-mode then? I thought it was similar to the bgs-core I referenced above.

from cordova-plugin-background-mode.

aml25 avatar aml25 commented on May 31, 2024

This is not an issue... Please read the documentation and assess for yourself if it will help you.

from cordova-plugin-background-mode.

christocracy avatar christocracy commented on May 31, 2024

No, this plugin will not help you. Android OS can and will kill your app
(where your Javascript lives) when the OS needs memory. The only way to
keep some particular functionality running in background (e.g.:
background-geolocation) is to implement that functionality as an Android
BackgroundService
https://developer.android.com/training/run-background-service/create-service.html
.

You cannot count upon your Javascript to continue running in the background
— you can assume that it will be killed at some point in the future
(minutes to hours)

On Fri, Jul 25, 2014 at 5:32 AM, seematalanki [email protected]
wrote:

hi,
we are building a mobile app which should not get killed even when it is
in background. will this plugin help me in doing so?


Reply to this email directly or view it on GitHub
#23.

Chris Scott
Transistor Software http://www.transistorsoft.com

from cordova-plugin-background-mode.

drakula84 avatar drakula84 commented on May 31, 2024

@christocracy I need a background service that talks to a backend server with a persistent connection. It is like Viber/telephony application so the server connection needs to be persistent, i.e. I need to receive incoming calls/msgs anytime. I am using socket.io to talk to the server. However, after a few mins, my Android device, for some reason, stops sending the heartbeat, hence server disconnects it.

I think Android OS is pausing (not sure ifI am using the right terminology) the entire application after a while. I have a loop that logs something every 10 seconds, and that loop stops working and nothing get logged.

This happens quicker when leave the device idle for a min and the screen goes dark (even when my application is the top application - when I press the button my application is there so I don't need to launch it from its icon) .

I tried to use this plugin but didn't help. Is it supposed to help though? Do I need to have normal socket service rather than socket.io/websocket?

I had initially thought this was to do with socket.io (hence the SO thread: http://stackoverflow.com/questions/26621732/socket-io-client-is-disconnected-randomly) but I think it is not a socket.io fault.

from cordova-plugin-background-mode.

christocracy avatar christocracy commented on May 31, 2024

Are you counting on Javascript continuing to run in the background on
Android? You cannot do this. When your app is running in the background,
Android will kill the app’s Android Activity
http://developer.android.com/reference/android/app/Activity.html (where
Javascript lives) at some point in the future, when memory is required by
the OS.

If you hope to guarantee execution of your application code in the
background, the only way is to do this natively with an Android
Background Service.
http://developer.android.com/training/run-background-service/index.html

On Wed, Nov 5, 2014 at 11:48 PM, drakula84 [email protected] wrote:

@christocracy https://github.com/christocracy I need a background
service that talks to a backend server with a persistent connection. It is
like Viber/telephony application so the server connection needs to be
persistent, i.e. I need to receive incoming calls/msgs anytime. I am using
socket.io to talk to the server. However, after a few mins, my Android
device, for some reason, stops sending the heartbeat, hence server
disconnects it.

I think Android OS is pausing (not sure ifI am using the right
terminology) the entire application after a while. I have a loop that logs
something every 10 seconds, and that loop stops working and nothing get
logged.

This happens quicker when leave the device idle for a min and the screen
goes dark (even when my application is the top application - when I press
the button my application is there so I don't need to launch it from its
icon) .

I tried to use this plugin but didn't help. Is it supposed to help though?
Do I need to have normal socket service rather than socket.io/websocket?

I had initially thought this was to do with socket.io (hence the SO
thread:
http://stackoverflow.com/questions/26621732/socket-io-client-is-disconnected-randomly)
but I think it is not a socket.io fault.


Reply to this email directly or view it on GitHub
#23 (comment)
.

Chris Scott
Transistor Software http://www.transistorsoft.com

from cordova-plugin-background-mode.

christocracy avatar christocracy commented on May 31, 2024

Running background javascript is not a problem in iOS. There are a number of ways to execute your javascript in the background.

from cordova-plugin-background-mode.

christocracy avatar christocracy commented on May 31, 2024

Yes, this Red-Folder guy is great.

On Thursday, November 6, 2014, drakula84 [email protected] wrote:

Thanks @christocracy https://github.com/christocracy - I am looking
into
https://github.com/Red-Folder/bgs-core/wiki/Build-your-own-Background-Service
to implement the background service. However, this plugin is Android only.
I will need to look for iOS one too.

Thanks for the clarification, however, I struggle to understand the
purpose of cordova-plugin-background-mode then? I thought it was similar to
the bgs-core I referenced above.


Reply to this email directly or view it on GitHub
#23 (comment)
.

Snet from Gmail Mobile

from cordova-plugin-background-mode.

drakula84 avatar drakula84 commented on May 31, 2024

Yes, I am going to experiment Red-Folder's plugin on Android. Then I going to looking into your methods for iOS side of the things.

So could you pls let me know what exactly is the purpose of katzer's background-mode plugin? I am probably missing the entire point.

Thanks @christocracy

from cordova-plugin-background-mode.

christocracy avatar christocracy commented on May 31, 2024

The purpose of this plugin is to wedge a stick into the mouth of a
crocodile to keep its jaws from closing by hacking ios to keeping battery
draining GPS radio burning or playing silent.wav background sound.

Good luck getting your app through Apple's gates with tactics like this.

On Friday, November 7, 2014, drakula84 [email protected] wrote:

Yes, I am going to experiment Red-Folder's plugin on Android. Then I going
to looking into your methods for iOS side of the things.

So could you pls let me know what exactly is the purpose of katzer's
background-mode plugin? I am probably missing the entire point.

Thanks @christocracy https://github.com/christocracy


Reply to this email directly or view it on GitHub
#23 (comment)
.

Snet from Gmail Mobile

from cordova-plugin-background-mode.

katzer avatar katzer commented on May 31, 2024

Guys, thats a public plug-in of a bigger enterprise application where connectivity and availability are much more important than battery usage or AppStore compliance!

@seematalanki, yes its the purpose of the plug-in to not get killed even when in background. For iOS there is no perfect solution except you have a special signed key with the right entitlements!

Even the README is not up-to-date, the master branch makes use of a service now for Android.

from cordova-plugin-background-mode.

christocracy avatar christocracy commented on May 31, 2024

Please tell me what exactly is your enterprise use-case where you need to
prevent ios from sleeping.

On Sunday, November 9, 2014, Sebastián Katzer [email protected]
wrote:

Guys, thats a public plug-in of a bigger enterprise application where
connectivity and availability are much more important than battery usage or
AppStore compliance!

@seematalanki https://github.com/seematalanki, yes its the purpose of
the plug-in to not get killed even when in background. For iOS there is no
perfect solution except you have a special signed key with the right
entitlements!

Even the README is not up-to-date, the master branch makes use of a
service now for Android.


Reply to this email directly or view it on GitHub
#23 (comment)
.

Snet from Gmail Mobile

from cordova-plugin-background-mode.

christocracy avatar christocracy commented on May 31, 2024

Perhaps you should put a giant Caveat Emptor warning in your README about
the nature of this plugin (wedging a stick in the jaws of a crocodile),
because this plugin leads many developers who don't understand the
ramifications of the tactics employed, to create poorly behaved
applications.

On Sunday, November 9, 2014, Sebastián Katzer [email protected]
wrote:

Guys, thats a public plug-in of a bigger enterprise application where
connectivity and availability are much more important than battery usage or
AppStore compliance!

@seematalanki https://github.com/seematalanki, yes its the purpose of
the plug-in to not get killed even when in background. For iOS there is no
perfect solution except you have a special signed key with the right
entitlements!

Even the README is not up-to-date, the master branch makes use of a
service now for Android.


Reply to this email directly or view it on GitHub
#23 (comment)
.

Snet from Gmail Mobile

from cordova-plugin-background-mode.

Related Issues (20)

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.