Closed teusink closed 9 years ago
Try the latest version. I think I found and fixed some null and exception bugs in that code.
Let me know how you get on. On 23 Nov 2013 15:44, "Joram Teusink" notifications@github.com wrote:
Hi, I have a strange NullPointerException when I close my app (navigator.app.exit). It happens to all my services. I double checked all my code with JSLint to check for some silly typos, but I cannot find anything.
All the services gets closed when exiting app. Android is restarting them after the app closes them, but still. It is not very nice :).
I have: PhoneGap 3.1.0, jQuery Mobile 1.3.2, and I am using your second to latest version of the Background 3.1.0 plugin (not the one with the register and deregister for updates).
I am rather stuck in where to find the cause of this issue, The log below does not point to any of my code.
Thanks in advance!
Log: 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): On Destroy Start 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Checking for services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Found services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.695: D/ServiceDetails(20289): Close called 11-23 16:31:15.695: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.800: D/ServiceDetails(20289): close failed 11-23 16:31:15.800: D/ServiceDetails(20289): java.lang.NullPointerException 11-23 16:31:15.800: D/ServiceDetails(20289): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.close(BackgroundServicePluginLogic.java:454) 11-23 16:31:15.800: D/ServiceDetails(20289): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic.onDestroy(BackgroundServicePluginLogic.java:199) 11-23 16:31:15.800: D/ServiceDetails(20289): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin.onDestroy(BackgroundServicePlugin.java:84) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.PluginManager.onDestroy(PluginManager.java:326) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.CordovaWebView.handleDestroy(CordovaWebView.java:833) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:774) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.Activity.performDestroy(Activity.java:5302) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3614) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3645) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.access$1200(ActivityThread.java:153) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1322) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Handler.dispatchMessage(Handler.java:99) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Looper.loop(Looper.java:137) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.main(ActivityThread.java:5289) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invokeNative(Native Method) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invoke(Method.java:525) 11-23 16:31:15.800: D/ServiceDetails(20289): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 11-23 16:31:15.800: D/ServiceDetails(20289): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 11-23 16:31:15.800: D/ServiceDetails(20289): at dalvik.system.NativeStart.main(Native Method) 11-23 16:31:15.804: D/ServiceDetails(20289): Ignoring exception - will continue 11-23 16:31:15.812: D/ServiceDetails(20289): Close finished 11-23 16:31:15.812: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.812: D/ServiceDetails(20289): Close called 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.812: D/BackgroundService(20289): Listener removed 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceConnection 11-23 16:31:15.816: D/ServiceDetails(20289): Close finished 11-23 16:31:15.816: D/BackgroundServicePluginLogic(20289): On Destroy Finish
config.xml
AndroidManifest.xml (I have 3 services <service android:name="org.teusink.droidpapers.UpdateChecker" android:enabled="true" android:exported="false">
Javascript cordova.define('cordova/plugin/updatechecker', function (require, exports, module) { CreateBackgroundService('org.teusink.droidpapers.UpdateChecker', require, exports, module); // JSLint error "Missing 'new' is oke here });
and function serviceUpdateChecker(action, input) { var updatechecker = cordova.require('cordova/plugin/updatechecker'); if (action === "getStatus") { updatechecker.getStatus( function (r) { handleUpdateCheckerSuccess(r); }, function (e) { handleUpdateCheckerError(e); } ); } // every command/action has his place here. }
How I call it: 'serviceUpdateChecker("getStatus"', "none");`
Then the Service gets started. But this services is never closed, unless explicitly commanded by the user, and not on app close. Same for all other services.
— Reply to this email directly or view it on GitHubhttps://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22 .
Thanks for your responce.
Do you have a small tip regarding the changes with the registerforupdates?
Can I still timer my services when needed?
2013/11/23 Mark Taylor notifications@github.com
Try the latest version. I think I found and fixed some null and exception bugs in that code.
Let me know how you get on. On 23 Nov 2013 15:44, "Joram Teusink" notifications@github.com wrote:
Hi, I have a strange NullPointerException when I close my app (navigator.app.exit). It happens to all my services. I double checked all my code with JSLint to check for some silly typos, but I cannot find anything.
All the services gets closed when exiting app. Android is restarting them after the app closes them, but still. It is not very nice :).
I have: PhoneGap 3.1.0, jQuery Mobile 1.3.2, and I am using your second to latest version of the Background 3.1.0 plugin (not the one with the register and deregister for updates).
I am rather stuck in where to find the cause of this issue, The log below does not point to any of my code.
Thanks in advance!
Log: 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): On Destroy Start 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Checking for services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Found services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.695: D/ServiceDetails(20289): Close called 11-23 16:31:15.695: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.800: D/ServiceDetails(20289): close failed 11-23 16:31:15.800: D/ServiceDetails(20289): java.lang.NullPointerException 11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.close(BackgroundServicePluginLogic.java:454)
11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic.onDestroy(BackgroundServicePluginLogic.java:199)
11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin.onDestroy(BackgroundServicePlugin.java:84)
11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.PluginManager.onDestroy(PluginManager.java:326) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.CordovaWebView.handleDestroy(CordovaWebView.java:833) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:774) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.Activity.performDestroy(Activity.java:5302) 11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117)
11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3614) 11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3645) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.access$1200(ActivityThread.java:153) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1322) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Handler.dispatchMessage(Handler.java:99) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Looper.loop(Looper.java:137) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.main(ActivityThread.java:5289) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invokeNative(Native Method) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invoke(Method.java:525) 11-23 16:31:15.800: D/ServiceDetails(20289): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
11-23 16:31:15.800: D/ServiceDetails(20289): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 11-23 16:31:15.800: D/ServiceDetails(20289): at dalvik.system.NativeStart.main(Native Method) 11-23 16:31:15.804: D/ServiceDetails(20289): Ignoring exception - will continue 11-23 16:31:15.812: D/ServiceDetails(20289): Close finished 11-23 16:31:15.812: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.812: D/ServiceDetails(20289): Close called 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.812: D/BackgroundService(20289): Listener removed 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceConnection 11-23 16:31:15.816: D/ServiceDetails(20289): Close finished 11-23 16:31:15.816: D/BackgroundServicePluginLogic(20289): On Destroy Finish
config.xml
AndroidManifest.xml (I have 3 services <service android:name="org.teusink.droidpapers.UpdateChecker" android:enabled="true" android:exported="false">
Javascript cordova.define('cordova/plugin/updatechecker', function (require, exports, module) { CreateBackgroundService('org.teusink.droidpapers.UpdateChecker', require, exports, module); // JSLint error "Missing 'new' is oke here });
and function serviceUpdateChecker(action, input) { var updatechecker = cordova.require('cordova/plugin/updatechecker'); if (action === "getStatus") { updatechecker.getStatus( function (r) { handleUpdateCheckerSuccess(r); }, function (e) { handleUpdateCheckerError(e); } ); } // every command/action has his place here. }
How I call it: 'serviceUpdateChecker("getStatus"', "none");`
Then the Service gets started. But this services is never closed, unless explicitly commanded by the user, and not on app close. Same for all other services.
— Reply to this email directly or view it on GitHub< https://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22> .
— Reply to this email directly or view it on GitHubhttps://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22#issuecomment-29135629 .
www.teusink.org
It just effects how you get updates to your page. Replaces the need for setinterval and getstatus in your javascript. Timer for the background service is unaffected.
Example of how to use in the sample html. On 23 Nov 2013 16:38, "Joram Teusink" notifications@github.com wrote:
Thanks for your responce.
Do you have a small tip regarding the changes with the registerforupdates?
Can I still timer my services when needed?
2013/11/23 Mark Taylor notifications@github.com
Try the latest version. I think I found and fixed some null and exception bugs in that code.
Let me know how you get on. On 23 Nov 2013 15:44, "Joram Teusink" notifications@github.com wrote:
Hi, I have a strange NullPointerException when I close my app (navigator.app.exit). It happens to all my services. I double checked all my code with JSLint to check for some silly typos, but I cannot find anything.
All the services gets closed when exiting app. Android is restarting them after the app closes them, but still. It is not very nice :).
I have: PhoneGap 3.1.0, jQuery Mobile 1.3.2, and I am using your second to latest version of the Background 3.1.0 plugin (not the one with the register and deregister for updates).
I am rather stuck in where to find the cause of this issue, The log below does not point to any of my code.
Thanks in advance!
Log: 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): On Destroy Start 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Checking for services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Found services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.695: D/ServiceDetails(20289): Close called 11-23 16:31:15.695: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.800: D/ServiceDetails(20289): close failed 11-23 16:31:15.800: D/ServiceDetails(20289): java.lang.NullPointerException 11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.close(BackgroundServicePluginLogic.java:454)
11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic.onDestroy(BackgroundServicePluginLogic.java:199)
11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin.onDestroy(BackgroundServicePlugin.java:84)
11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.PluginManager.onDestroy(PluginManager.java:326) 11-23 16:31:15.800: D/ServiceDetails(20289): at
org.apache.cordova.CordovaWebView.handleDestroy(CordovaWebView.java:833) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:774) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.Activity.performDestroy(Activity.java:5302) 11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117)
11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3614)
11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3645)
11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.access$1200(ActivityThread.java:153) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1322) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Handler.dispatchMessage(Handler.java:99) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Looper.loop(Looper.java:137) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.main(ActivityThread.java:5289) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invokeNative(Native Method) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invoke(Method.java:525) 11-23 16:31:15.800: D/ServiceDetails(20289): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
11-23 16:31:15.800: D/ServiceDetails(20289): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 11-23 16:31:15.800: D/ServiceDetails(20289): at dalvik.system.NativeStart.main(Native Method) 11-23 16:31:15.804: D/ServiceDetails(20289): Ignoring exception - will continue 11-23 16:31:15.812: D/ServiceDetails(20289): Close finished 11-23 16:31:15.812: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.812: D/ServiceDetails(20289): Close called 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.812: D/BackgroundService(20289): Listener removed 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceConnection 11-23 16:31:15.816: D/ServiceDetails(20289): Close finished 11-23 16:31:15.816: D/BackgroundServicePluginLogic(20289): On Destroy Finish
config.xml
value="com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin"
/>
AndroidManifest.xml (I have 3 services <service android:name="org.teusink.droidpapers.UpdateChecker" android:enabled="true" android:exported="false">
Javascript cordova.define('cordova/plugin/updatechecker', function (require, exports, module) { CreateBackgroundService('org.teusink.droidpapers.UpdateChecker', require, exports, module); // JSLint error "Missing 'new' is oke here });
and function serviceUpdateChecker(action, input) { var updatechecker = cordova.require('cordova/plugin/updatechecker'); if (action === "getStatus") { updatechecker.getStatus( function (r) { handleUpdateCheckerSuccess(r); }, function (e) { handleUpdateCheckerError(e); } ); } // every command/action has his place here. }
How I call it: 'serviceUpdateChecker("getStatus"', "none");`
Then the Service gets started. But this services is never closed, unless explicitly commanded by the user, and not on app close. Same for all other services.
— Reply to this email directly or view it on GitHub< https://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22>
.
— Reply to this email directly or view it on GitHub< https://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22#issuecomment-29135629>
.
www.teusink.org
— Reply to this email directly or view it on GitHubhttps://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22#issuecomment-29135728 .
Thanks. I will look in to it tomorrow and will let you know. Op 23 nov. 2013 17:48 schreef "Mark Taylor" notifications@github.com:
It just effects how you get updates to your page. Replaces the need for setinterval and getstatus in your javascript. Timer for the background service is unaffected.
Example of how to use in the sample html. On 23 Nov 2013 16:38, "Joram Teusink" notifications@github.com wrote:
Thanks for your responce.
Do you have a small tip regarding the changes with the registerforupdates?
Can I still timer my services when needed?
2013/11/23 Mark Taylor notifications@github.com
Try the latest version. I think I found and fixed some null and exception bugs in that code.
Let me know how you get on. On 23 Nov 2013 15:44, "Joram Teusink" notifications@github.com wrote:
Hi, I have a strange NullPointerException when I close my app (navigator.app.exit). It happens to all my services. I double checked all my code with JSLint to check for some silly typos, but I cannot find anything.
All the services gets closed when exiting app. Android is restarting them after the app closes them, but still. It is not very nice :).
I have: PhoneGap 3.1.0, jQuery Mobile 1.3.2, and I am using your second to latest version of the Background 3.1.0 plugin (not the one with the register and deregister for updates).
I am rather stuck in where to find the cause of this issue, The log below does not point to any of my code.
Thanks in advance!
Log: 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): On Destroy Start 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Checking for services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Found services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.695: D/ServiceDetails(20289): Close called 11-23 16:31:15.695: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.800: D/ServiceDetails(20289): close failed 11-23 16:31:15.800: D/ServiceDetails(20289): java.lang.NullPointerException 11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.close(BackgroundServicePluginLogic.java:454)
11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic.onDestroy(BackgroundServicePluginLogic.java:199)
11-23 16:31:15.800: D/ServiceDetails(20289): at
com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin.onDestroy(BackgroundServicePlugin.java:84)
11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.PluginManager.onDestroy(PluginManager.java:326) 11-23 16:31:15.800: D/ServiceDetails(20289): at
org.apache.cordova.CordovaWebView.handleDestroy(CordovaWebView.java:833) 11-23 16:31:15.800: D/ServiceDetails(20289): at
org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:774) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.Activity.performDestroy(Activity.java:5302) 11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117)
11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3614)
11-23 16:31:15.800: D/ServiceDetails(20289): at
android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3645)
11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.access$1200(ActivityThread.java:153) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1322) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Handler.dispatchMessage(Handler.java:99) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Looper.loop(Looper.java:137) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.main(ActivityThread.java:5289) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invokeNative(Native Method) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invoke(Method.java:525) 11-23 16:31:15.800: D/ServiceDetails(20289): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
11-23 16:31:15.800: D/ServiceDetails(20289): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 11-23 16:31:15.800: D/ServiceDetails(20289): at dalvik.system.NativeStart.main(Native Method) 11-23 16:31:15.804: D/ServiceDetails(20289): Ignoring exception - will continue 11-23 16:31:15.812: D/ServiceDetails(20289): Close finished 11-23 16:31:15.812: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.812: D/ServiceDetails(20289): Close called 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.812: D/BackgroundService(20289): Listener removed 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceConnection 11-23 16:31:15.816: D/ServiceDetails(20289): Close finished 11-23 16:31:15.816: D/BackgroundServicePluginLogic(20289): On Destroy Finish
config.xml
value="com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin"
/>
AndroidManifest.xml (I have 3 services <service android:name="org.teusink.droidpapers.UpdateChecker" android:enabled="true" android:exported="false">
Javascript cordova.define('cordova/plugin/updatechecker', function (require, exports, module) { CreateBackgroundService('org.teusink.droidpapers.UpdateChecker', require, exports, module); // JSLint error "Missing 'new' is oke here });
and function serviceUpdateChecker(action, input) { var updatechecker = cordova.require('cordova/plugin/updatechecker'); if (action === "getStatus") { updatechecker.getStatus( function (r) { handleUpdateCheckerSuccess(r); }, function (e) { handleUpdateCheckerError(e); } ); } // every command/action has his place here. }
How I call it: 'serviceUpdateChecker("getStatus"', "none");`
Then the Service gets started. But this services is never closed, unless explicitly commanded by the user, and not on app close. Same for all other services.
— Reply to this email directly or view it on GitHub<
https://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22>
.
— Reply to this email directly or view it on GitHub<
https://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22#issuecomment-29135629>
.
www.teusink.org
— Reply to this email directly or view it on GitHub< https://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22#issuecomment-29135728>
.
— Reply to this email directly or view it on GitHubhttps://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22#issuecomment-29135918 .
Hi, Issue seems fixed with latest release. Thank you for your support and fast responce. :+1:
Great news. Thanks for letting me know. On 24 Nov 2013 15:22, "Joram Teusink" notifications@github.com wrote:
Hi, Issue seems fixed with latest release. Thank you for your support and fast responce. [image: :+1:]
— Reply to this email directly or view it on GitHubhttps://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22#issuecomment-29157600 .
Mmm, now this bug raises, using the latest plugin of 3.1.0. It happens on app exit. Services seem to work fine though.
11-27 21:32:09.186: D/BackgroundServicePluginLogic(30611): On Destroy Start 11-27 21:32:09.186: D/BackgroundServicePluginLogic(30611): Checking for services 11-27 21:32:09.186: D/BackgroundServicePluginLogic(30611): Found services 11-27 21:32:09.186: D/BackgroundServicePluginLogic(30611): Calling service.close() 11-27 21:32:09.186: D/ServiceDetails(30611): Close called 11-27 21:32:09.186: D/ServiceDetails(30611): Removing ServiceListener 11-27 21:32:09.186: D/BackgroundService(30611): Listener removed 11-27 21:32:09.186: D/ServiceDetails(30611): Removing ServiceConnection 11-27 21:32:09.186: D/ServiceDetails(30611): Close finished 11-27 21:32:09.186: D/BackgroundServicePluginLogic(30611): Calling service.close() 11-27 21:32:09.186: D/ServiceDetails(30611): Close called 11-27 21:32:09.186: D/ServiceDetails(30611): Removing ServiceListener 11-27 21:32:09.196: D/ServiceDetails(30611): close failed 11-27 21:32:09.196: D/ServiceDetails(30611): java.lang.NullPointerException 11-27 21:32:09.196: D/ServiceDetails(30611): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.close(BackgroundServicePluginLogic.java:555) 11-27 21:32:09.196: D/ServiceDetails(30611): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic.onDestroy(BackgroundServicePluginLogic.java:246) 11-27 21:32:09.196: D/ServiceDetails(30611): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin.onDestroy(BackgroundServicePlugin.java:102) 11-27 21:32:09.196: D/ServiceDetails(30611): at org.apache.cordova.PluginManager.onDestroy(PluginManager.java:326) 11-27 21:32:09.196: D/ServiceDetails(30611): at org.apache.cordova.CordovaWebView.handleDestroy(CordovaWebView.java:833) 11-27 21:32:09.196: D/ServiceDetails(30611): at org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:774) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.app.Activity.performDestroy(Activity.java:5302) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3614) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3645) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.app.ActivityThread.access$1200(ActivityThread.java:153) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1322) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.os.Handler.dispatchMessage(Handler.java:99) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.os.Looper.loop(Looper.java:137) 11-27 21:32:09.196: D/ServiceDetails(30611): at android.app.ActivityThread.main(ActivityThread.java:5289) 11-27 21:32:09.196: D/ServiceDetails(30611): at java.lang.reflect.Method.invokeNative(Native Method) 11-27 21:32:09.196: D/ServiceDetails(30611): at java.lang.reflect.Method.invoke(Method.java:525) 11-27 21:32:09.196: D/ServiceDetails(30611): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 11-27 21:32:09.196: D/ServiceDetails(30611): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 11-27 21:32:09.196: D/ServiceDetails(30611): at dalvik.system.NativeStart.main(Native Method) 11-27 21:32:09.196: D/ServiceDetails(30611): Ignoring exception - will continue 11-27 21:32:09.196: D/ServiceDetails(30611): Close finished 11-27 21:32:09.196: D/BackgroundServicePluginLogic(30611): On Destroy Finish
Any thoughts on that one?
It's from this code (line 555 of https://github.com/Red-Folder/Cordova-Plugin-BackgroundService-Source/blob/master/src/com/red_folder/phonegap/plugin/backgroundservice/BackgroundServicePluginLogic.java):
mApi.removeListener(serviceListener);
Looking at it I don't believe it is a problem. I probably just need to check for null on a couple of places.
I'll fix this in a couple of weeks if that's ok. I've got an exam on the 14th so I'm focusing on that at the moment.
If it becomes a problem, then let me know.
Hey Mark, not a problem at all. Please do focus on your exam! I have them myselfs too atm... :) Good luck and hope you will pass it!
www.teusink.org Op 29 nov. 2013 13:43 schreef "Mark Taylor" notifications@github.com:
It's from this code (line 555 of https://github.com/Red-Folder/Cordova-Plugin-BackgroundService-Source/blob/master/src/com/red_folder/phonegap/plugin/backgroundservice/BackgroundServicePluginLogic.java):
mApi.removeListener(serviceListener);
Looking at it I don't believe it is a problem. I probably just need to check for null on a couple of places.
I'll fix this in a couple of weeks if that's ok. I've got an exam on the 14th so I'm focusing on that at the moment.
If it becomes a problem, then let me know.
— Reply to this email directly or view it on GitHubhttps://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/22#issuecomment-29514234 .
Moved issue to new Repo -> https://github.com/Red-Folder/bgs-core/issues/27
Hi, I have a strange NullPointerException when I close my app (navigator.app.exit). It happens to all my services. I double checked all my code with JSLint to check for some silly typos, but I cannot find anything.
All the services gets closed when exiting app. Android is restarting them after the app closes them, but still. It is not very nice :).
I have: PhoneGap 3.1.0, jQuery Mobile 1.3.2, and I am using your second to latest version of the Background 3.1.0 plugin (not the one with the register and deregister for updates).
I am rather stuck in where to find the cause of this issue, The log below does not point to any of my code.
Thanks in advance!
Log:
11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): On Destroy Start 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Checking for services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Found services 11-23 16:31:15.695: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.695: D/ServiceDetails(20289): Close called 11-23 16:31:15.695: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.800: D/ServiceDetails(20289): close failed 11-23 16:31:15.800: D/ServiceDetails(20289): java.lang.NullPointerException 11-23 16:31:15.800: D/ServiceDetails(20289): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic$ServiceDetails.close(BackgroundServicePluginLogic.java:454) 11-23 16:31:15.800: D/ServiceDetails(20289): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePluginLogic.onDestroy(BackgroundServicePluginLogic.java:199) 11-23 16:31:15.800: D/ServiceDetails(20289): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin.onDestroy(BackgroundServicePlugin.java:84) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.PluginManager.onDestroy(PluginManager.java:326) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.CordovaWebView.handleDestroy(CordovaWebView.java:833) 11-23 16:31:15.800: D/ServiceDetails(20289): at org.apache.cordova.CordovaActivity.onDestroy(CordovaActivity.java:774) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.Activity.performDestroy(Activity.java:5302) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3614) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3645) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.access$1200(ActivityThread.java:153) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1322) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Handler.dispatchMessage(Handler.java:99) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.os.Looper.loop(Looper.java:137) 11-23 16:31:15.800: D/ServiceDetails(20289): at android.app.ActivityThread.main(ActivityThread.java:5289) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invokeNative(Native Method) 11-23 16:31:15.800: D/ServiceDetails(20289): at java.lang.reflect.Method.invoke(Method.java:525) 11-23 16:31:15.800: D/ServiceDetails(20289): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739) 11-23 16:31:15.800: D/ServiceDetails(20289): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) 11-23 16:31:15.800: D/ServiceDetails(20289): at dalvik.system.NativeStart.main(Native Method) 11-23 16:31:15.804: D/ServiceDetails(20289): Ignoring exception - will continue 11-23 16:31:15.812: D/ServiceDetails(20289): Close finished 11-23 16:31:15.812: D/BackgroundServicePluginLogic(20289): Calling service.close() 11-23 16:31:15.812: D/ServiceDetails(20289): Close called 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceListener 11-23 16:31:15.812: D/BackgroundService(20289): Listener removed 11-23 16:31:15.812: D/ServiceDetails(20289): Removing ServiceConnection 11-23 16:31:15.816: D/ServiceDetails(20289): Close finished 11-23 16:31:15.816: D/BackgroundServicePluginLogic(20289): On Destroy Finish
config.xml
<feature name="BackgroundServicePlugin"><param name="android-package" value="com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin" /></feature>
AndroidManifest.xml (I have 3 services `<service android:name="org.teusink.droidpapers.UpdateChecker" android:enabled="true" android:exported="false">
Javascript
cordova.define('cordova/plugin/updatechecker', function (require, exports, module) { CreateBackgroundService('org.teusink.droidpapers.UpdateChecker', require, exports, module); // JSLint error "Missing 'new' is oke here });
and
function serviceUpdateChecker(action, input) { var updatechecker = cordova.require('cordova/plugin/updatechecker'); if (action === "getStatus") { updatechecker.getStatus( function (r) { handleUpdateCheckerSuccess(r); }, function (e) { handleUpdateCheckerError(e); } ); } // every command/action has his place here. }
How I call it: 'serviceUpdateChecker("getStatus"', "none");`
Then the Service gets started. But this services is never closed, unless explicitly commanded by the user, and not on app close. Same for all other services.