Comments (6)
Same issue, i notice that if i close the app the service stop logging, in the running apps in the device i see the app but with 0 process and 1 service
Phonegap 4.2.0-0.23.0
Android Device 4.4.2
from bgs-core.
Does the service ever start?
The service should show in logcat as "MyService". I'm not seeing it in the above logcat - this maybe because the service hasn't started or you've filtered out of the logcat.
If in doubt, post a full logcat of start, run, stop (full lifecycle)
from bgs-core.
Service is started ..timer task run every time interval when the app is open....if i close the app then timer task never run(for checking used the notificaton in doWork()) ....the above one is the stacktrace in my app..if you want i will send my entire application..
from bgs-core.
In your logcat, you should have various logs Tag'ed as "Background Service"
You should see the Background Service giving messages like "Timer task starting work" & "Timer task completing work". This the code that wraps the doWork.
Are you seeing these message in your logcat when the app is open? Are you seeing these message in your logcat when the app is closed?
(If in doubt, post the whole logcat)
from bgs-core.
Logcat(When starting the service)
D/BackgroundServicePluginLogic(16652): Start of Execute
D/BackgroundServicePluginLogic(16652): Withing try block
D/BackgroundServicePluginLogic(16652): Finding servicename com.processdrive.novema.NovemaStagingBackupService
D/BackgroundServicePluginLogic(16652): Services contain 0 records
D/BackgroundServicePluginLogic(16652): Creating new Service Details
D/BackgroundServicePluginLogic(16652): Action = getStatus
D/BackgroundServicePlugin(16652): logicResult = com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ExecuteResult@41e66c40
D/BackgroundServicePlugin(16652): Start of transformResult
D/BackgroundServicePlugin(16652): Status is OK
D/BackgroundServicePlugin(16652): We have data
D/BackgroundServicePlugin(16652): End of transformResult
D/BackgroundServicePlugin(16652): pluginResult = org.apache.cordova.PluginResult@41e6f378
D/BackgroundServicePlugin(16652): pluginResult.getMessage() = {"ErrorCode":0,"Success":true,"RegisteredForUpdates":false,"RegisteredForBootStart":false,"ErrorMessage":"","ServiceRunning":false}
D/BackgroundServicePlugin(16652): Dont keep Callback
D/BackgroundServicePluginLogic(16652): Start of Execute
D/BackgroundServicePluginLogic(16652): Withing try block
D/BackgroundServicePluginLogic(16652): Finding servicename com.processdrive.novema.NovemaStagingBackupService
D/BackgroundServicePluginLogic(16652): Services contain 1 records
D/BackgroundServicePluginLogic(16652): Found existing Service Details
D/BackgroundServicePluginLogic(16652): Action = startService
D/ServiceDetails(16652): Starting startService
D/ServiceDetails(16652): Attempting to bind to Service
D/ServiceDetails(16652): Starting bindToService
D/ServiceDetails(16652): Attempting to start service
W/ContextImpl(16652): Implicit intents with startService are not safe: Intent { act=com.processdrive.novema.NovemaStagingBackupService } android.content.ContextWrapper.startService:494 com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.bindToService:604 com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.startService:335
D/ServiceDetails(16652): Attempting to bind to service
W/ContextImpl(16652): Implicit intents with startService are not safe: Intent { act=com.processdrive.novema.NovemaStagingBackupService } android.content.ContextWrapper.bindService:517 com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.bindToService:607 com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.startService:335
D/ServiceDetails(16652): Waiting for service connected lock
I/BackgroundService(16652): Service creating
I/BackgroundService(16652): Initialising the service
I/BackgroundService(16652): Syncing result
I/BackgroundService(16652): Service started
I/BackgroundService(16652): onBind called
D/BackgroundService(16652): Listener added
D/ServiceDetails(16652): Finished bindToService
D/ServiceDetails(16652): Bind worked
D/ServiceDetails(16652): Finished startService
D/BackgroundServicePlugin(16652): logicResult = com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ExecuteResult@41e58488
D/BackgroundServicePlugin(16652): Start of transformResult
D/BackgroundServicePlugin(16652): Status is OK
D/BackgroundServicePlugin(16652): We have data
D/BackgroundServicePlugin(16652): End of transformResult
D/BackgroundServicePlugin(16652): pluginResult = org.apache.cordova.PluginResult@41e74750
D/BackgroundServicePlugin(16652): pluginResult.getMessage() = {"TimerMilliseconds":60000,"LatestResult":{},"ErrorMessage":"","Configuration":{},"ErrorCode":0,"Success":true,"RegisteredForUpdates":false,"RegisteredForBootStart":false,"TimerEnabled":true,"ServiceRunning":true}
D/BackgroundServicePlugin(16652): Dont keep Callback
D/CordovaActivity(16652): onMessage(spinner,stop)
D/BackgroundServicePluginLogic(16652): Start of Execute
D/BackgroundServicePluginLogic(16652): Withing try block
D/BackgroundServicePluginLogic(16652): Finding servicename com.processdrive.novema.NovemaStagingBackupService
D/BackgroundServicePluginLogic(16652): Services contain 1 records
D/BackgroundServicePluginLogic(16652): Found existing Service Details
D/BackgroundServicePluginLogic(16652): Action = registerForUpdates
D/BackgroundServicePlugin(16652): logicResult = com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ExecuteResult@41e76008
D/BackgroundServicePlugin(16652): Start of transformResult
D/BackgroundServicePlugin(16652): Status is OK
D/BackgroundServicePlugin(16652): We have data
D/BackgroundServicePlugin(16652): Keep Callback set to true
D/BackgroundServicePlugin(16652): End of transformResult
D/BackgroundServicePlugin(16652): pluginResult = org.apache.cordova.PluginResult@41e7c500
D/BackgroundServicePlugin(16652): pluginResult.getMessage() = {"TimerMilliseconds":60000,"LatestResult":{},"ErrorMessage":"","Configuration":{},"ErrorCode":0,"Success":true,"RegisteredForUpdates":true,"RegisteredForBootStart":false,"TimerEnabled":true,"ServiceRunning":true}
D/BackgroundServicePlugin(16652): Keep Callback
I/BackgroundService(16652): Timer task starting work
D/BackgroundService(16652): Is the service paused?
D/BackgroundService(16652): Service is not paused
I/BackgroundService(16652): Syncing result
I/BackgroundService(16652): Sending to all listeners
D/ServiceDetails(16652): Latest results received
D/ServiceDetails(16652): Calling listener
D/BackgroundServicePlugin(16652): Starting handleUpdate
D/BackgroundServicePlugin(16652): Sending update
D/BackgroundServicePlugin(16652): Start of transformResult
D/BackgroundServicePlugin(16652): Status is OK
D/BackgroundServicePlugin(16652): We have data
D/BackgroundServicePlugin(16652): Keep Callback set to true
D/BackgroundServicePlugin(16652): End of transformResult
D/BackgroundServicePlugin(16652): Sent update
D/BackgroundServicePlugin(16652): Finished handleUpdate
D/ServiceDetails(16652): Listener finished
I/BackgroundService(16652): Sent listener - 0
I/BackgroundService(16652): Timer task completing work
Timer task start work(when the app is open)
I/BackgroundService(16652): Timer task starting work
D/BackgroundService(16652): Is the service paused?
D/BackgroundService(16652): Service is not paused
I/BackgroundService(16652): Syncing result
I/BackgroundService(16652): Sending to all listeners
D/ServiceDetails(16652): Latest results received
D/ServiceDetails(16652): Calling listener
D/BackgroundServicePlugin(16652): Starting handleUpdate
D/BackgroundServicePlugin(16652): Sending update
D/BackgroundServicePlugin(16652): Start of transformResult
D/BackgroundServicePlugin(16652): Status is OK
D/BackgroundServicePlugin(16652): We have data
D/BackgroundServicePlugin(16652): Keep Callback set to true
D/BackgroundServicePlugin(16652): End of transformResult
D/BackgroundServicePlugin(16652): Sent update
D/BackgroundServicePlugin(16652): Finished handleUpdate
D/ServiceDetails(16652): Listener finished
I/BackgroundService(16652): Sent listener - 0
I/BackgroundService(16652): Timer task completing work
when close the app
D/BackgroundServicePluginLogic(16652): On Destroy Start
D/BackgroundServicePluginLogic(16652): Checking for services
D/BackgroundServicePluginLogic(16652): Found services
D/BackgroundServicePluginLogic(16652): Calling service.close()
D/ServiceDetails(16652): Close called
D/ServiceDetails(16652): Listener deregistering
D/ServiceDetails(16652): Listener closing
D/BackgroundServicePlugin(16652): Starting closeListener
D/BackgroundServicePlugin(16652): Sending update
D/BackgroundServicePlugin(16652): Start of transformResult
D/BackgroundServicePlugin(16652): Status is OK
D/BackgroundServicePlugin(16652): We have data
D/BackgroundServicePlugin(16652): End of transformResult
D/BackgroundServicePlugin(16652): Sent update
D/BackgroundServicePlugin(16652): Finished closeListener
D/ServiceDetails(16652): Listener closed
D/ServiceDetails(16652): Listener deregistered
D/ServiceDetails(16652): Removing ServiceListener
D/BackgroundService(16652): Listener removed
D/ServiceDetails(16652): Removing ServiceConnection
D/ServiceDetails(16652): Close finished
D/BackgroundServicePluginLogic(16652): On Destroy Finish
from bgs-core.
The following code resolved the issue...Your plugin works well the problem is android kitkat version..
Thank you so much...
// this is for kitkat (nexus 7 tablet) service issue
public void onTaskRemoved(Intent rootIntent) {
// TODO Auto-generated method stub
Intent restartService = new Intent(getApplicationContext(),
this.getClass());
restartService.setPackage(getPackageName());
PendingIntent restartServicePI = PendingIntent.getService(
getApplicationContext(), 1, restartService,
PendingIntent.FLAG_ONE_SHOT);
AlarmManager alarmService = (AlarmManager)getApplicationContext().getSystemService(Context.ALARM_SERVICE);
alarmService.set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() +1000, restartServicePI);
}
the code is place in BackService.java class..
from bgs-core.
Related Issues (20)
- Error Occurs on startService(success,failed) ;
- Backgound service stops when the app is terminated HOT 2
- creating multiple service class HOT 2
- Does this plugin works with local notifications? HOT 2
- Integrating with NotificationListenerService would it work?
- If Background Service is Running Through Any Local Notification or Alerts?
- Where to put MyService.java in IONIC? Android is unable to find/bind. HOT 2
- Error on Boot
- Its not working in Android 10 HOT 1
- running cordova inside of a service HOT 5
- What is service will not running when app closed ? HOT 8
- It's Possible MyService.java Call Javascript Function ? HOT 3
- ideas to make a service to continue receiving push notifications HOT 2
- Build Android Error HOT 13
- Add method onCleanup to override
- Can I load a third party android library?
- Service starting but restart on exit failing
- Application run but factory is empty
- How to stop a Countdown when the App is backgrounded (Xamarin forms) HOT 2
- Detect the volum up pression in background service
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bgs-core.