Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhoneGap 2.8.0 #7

Closed
teusink opened this issue Jun 10, 2013 · 34 comments
Closed

PhoneGap 2.8.0 #7

teusink opened this issue Jun 10, 2013 · 34 comments
Assignees
Labels

Comments

@teusink
Copy link

teusink commented Jun 10, 2013

Hi, can you release a PhoneGap 2.8.0 version? Current version seems to work with the latest PhoneGap version, although I saw a NullPointerException in the log of a user. Perhaps some random weird stuff, perhaps not. See log below.

java.lang.NullPointerException at org.apache.cordova.api.PluginResult.<init>(PluginResult.java:52) at org.apache.cordova.api.CallbackContext.error(CallbackContext.java:125) at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin$1.run(BackgroundServicePlugin.java:55) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856)

@Red-Folder
Copy link
Owner

With reference to the NullPointerException, can you provide the logcat contents as well please. I'm expecting there to be a problem earlier in the process.

@teusink
Copy link
Author

teusink commented Jun 12, 2013

Hi, to bad I can not :). I did not suffer from the error, but some user that reported it through Play Store. I understand completely if you cannot start on "bug"-fixing this. It is still possible that the app did not install properly or anything.

@Red-Folder
Copy link
Owner

Problem is that without the logcat I'm guessing at the bug. I'll have to review the code - certainly it shouldn't be crashing out completely - so if nothing else I need to put some additional defensive code in there.

Out of interest, what's the name of your app?

@ghost ghost assigned Red-Folder Jun 12, 2013
@teusink
Copy link
Author

teusink commented Jul 4, 2013

My app is DroidPapers (did I reply o this by emai btw?).

Are you going to compile it against 2.9.0?

@Red-Folder
Copy link
Owner

Yes I will compile against the newer versions. I've recently been tied up with day job, freelance work, exam study, and about 100 over things.

Currently I'm taking the time to try and automated the build & test across multiple versions of Cordova. Currently it's so time consuming that I need a large window of time to do it.

Obviously there is nothing stopping anyone from forking (against the source) and issuing a PULL.

@teusink
Copy link
Author

teusink commented Jul 5, 2013

Hi. No worries and no rush and thanks in advance! :)

@everluck
Copy link

using 2.9.0, facing the same problem

@Red-Folder
Copy link
Owner

@everluck

Are you able to reliably recreate the problem?

Are you able to provide logcat details?

Do you get the same problem if you use Cordova 2.7.0?

@everluck
Copy link

hi.. sorry for my late reply
I've pulled off the plugin from my app after facing the same problem above and cant figure it out and try to start using native lang
To provide you the logcat details, I rebuild my app using this plugin again, and it works perfectly, no error.
I still dont understand why.
Thank you for your effort to make this plugin. This is great, keep it up!

@greips
Copy link

greips commented Aug 19, 2013

Hi @Red-Folder ,
I have this same problem using 2.7 version Where do you want me to send you the logcat?

@Red-Folder
Copy link
Owner

Please post it here in the issue

@greips
Copy link

greips commented Aug 19, 2013

Hi @Red-Folder

This is the full logcat, with phonegap at VERBOSE log level. I've just replaced the app name and now it's com.xxxxx.xxxxxx ;-)

08-19 18:48:38.994: D/Xmile APID(27704): null
08-19 18:48:39.129: D/dalvikvm(27704): GC_CONCURRENT freed 294K, 4% free 9802K/10128K, paused 4ms+3ms, total 26ms
08-19 18:48:39.144: I/CordovaLog(27704): Changing log level to VERBOSE(2)
08-19 18:48:39.144: I/CordovaLog(27704): Found preference for useBrowserHistory=false
08-19 18:48:39.144: D/CordovaLog(27704): Found preference for useBrowserHistory=false
08-19 18:48:39.144: D/DroidGap(27704): DroidGap.onCreate()
08-19 18:48:39.149: D/DroidGap(27704): Setting integer properties in DroidGap will be deprecated in 3.1 on August 2013, please use config.xml
08-19 18:48:39.194: D/CordovaWebView(27704): CordovaWebView is running on device made by: unknown
08-19 18:48:39.204: D/JsMessageQueue(27704): Set native->JS mode to 2
08-19 18:48:39.214: D/DroidGap(27704): DroidGap.init()
08-19 18:48:39.399: D/dalvikvm(27704): GC_FOR_ALLOC freed 144K, 3% free 9877K/10128K, paused 59ms, total 59ms
08-19 18:48:39.419: I/dalvikvm-heap(27704): Grow heap (frag case) to 12.309MB for 2764816-byte allocation
08-19 18:48:39.444: D/dalvikvm(27704): GC_FOR_ALLOC freed 2K, 3% free 12574K/12832K, paused 26ms, total 26ms
08-19 18:48:39.469: D/dalvikvm(27704): GC_CONCURRENT freed 12K, 3% free 12570K/12832K, paused 4ms+2ms, total 23ms
08-19 18:48:39.489: D/CordovaWebView(27704): DroidGap.loadUrl(file:///android_asset/www/index.html, 10000)
08-19 18:48:39.489: D/DroidGap(27704): onMessage(splashscreen,show)
08-19 18:48:39.489: D/CordovaWebView(27704): >>> loadUrl(file:///android_asset/www/index.html)
08-19 18:48:39.489: D/PluginManager(27704): init()
08-19 18:48:39.494: D/CordovaWebView(27704): >>> loadUrlNow()
08-19 18:48:39.514: D/DroidGap(27704): Resuming the App
08-19 18:48:39.624: D/libEGL(27704): loaded /system/lib/egl/libEGL_tegra.so
08-19 18:48:39.689: D/libEGL(27704): loaded /system/lib/egl/libGLESv1_CM_tegra.so
08-19 18:48:39.689: D/NvOsDebugPrintf(27704): NvRmModuleGetNumInstances: Could not read register_sets
08-19 18:48:39.694: D/NvOsDebugPrintf(27704): NvRmModuleGetNumInstances: Could not read register_sets
08-19 18:48:39.709: D/libEGL(27704): loaded /system/lib/egl/libGLESv2_tegra.so
08-19 18:48:39.759: D/NvOsDebugPrintf(27704): NvRmModuleGetNumInstances: Could not read register_sets
08-19 18:48:39.764: D/NvOsDebugPrintf(27704): NvRmModuleGetNumInstances: Could not read register_sets
08-19 18:48:39.769: D/NvOsDebugPrintf(27704): NvRmModuleGetNumInstances: Could not read register_sets
08-19 18:48:39.774: D/OpenGLRenderer(27704): Enabling debug mode 0
08-19 18:48:39.774: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:48:39.819: D/DroidGap(27704): onMessage(onPageStarted,file:///android_asset/www/index.html)
08-19 18:48:40.144: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:48:40.154: D/dalvikvm(27704): GC_CONCURRENT freed 242K, 3% free 13240K/13528K, paused 6ms+2ms, total 32ms
08-19 18:48:40.154: D/dalvikvm(27704): WAIT_FOR_CONCURRENT_GC blocked 24ms
08-19 18:48:40.309: D/chromium(27704): Unknown chromium error: -6
08-19 18:48:40.379: D/CordovaNetworkManager(27704): Connection Type: wifi
08-19 18:48:40.379: D/CordovaNetworkManager(27704): Connection Type: wifi
08-19 18:48:40.379: D/DroidGap(27704): onMessage(networkconnection,wifi)
08-19 18:48:40.384: D/DroidGap(27704): onMessage(spinner,stop)
08-19 18:48:41.294: D/dalvikvm(27704): GC_CONCURRENT freed 1242K, 9% free 13124K/14420K, paused 3ms+3ms, total 21ms
08-19 18:48:41.294: D/dalvikvm(27704): WAIT_FOR_CONCURRENT_GC blocked 17ms
08-19 18:48:41.639: D/TilesManager(27704): Starting TG #0, 0x5c475f38
08-19 18:48:41.639: D/TilesManager(27704): new EGLContext from framework: 59e22b18
08-19 18:48:41.644: D/GLWebViewState(27704): Reinit shader
08-19 18:48:41.704: D/GLWebViewState(27704): Reinit transferQueue
08-19 18:48:42.334: D/Cordova(27704): onPageFinished(file:///android_asset/www/index.html#comensa)
08-19 18:48:42.334: D/DroidGap(27704): onMessage(onPageFinished,file:///android_asset/www/index.html#comensa)
08-19 18:48:42.509: I/App(27704): WARNING: Back Button Default Behaviour will be overridden. The backbutton event will be fired!
08-19 18:48:42.709: D/BackgroundServicePluginLogic(27704): Start of Execute
08-19 18:48:42.709: D/BackgroundServicePluginLogic(27704): Withing try block
08-19 18:48:42.709: D/BackgroundServicePluginLogic(27704): Finding servicename com.xxxxx.xxxxxx.XLocator
08-19 18:48:42.709: D/BackgroundServicePluginLogic(27704): Services contain 0 records
08-19 18:48:42.709: D/DroidGap(27704): onMessage(splashscreen,hide)
08-19 18:48:42.709: D/BackgroundServicePluginLogic(27704): Creating new Service Details
08-19 18:48:42.714: D/BackgroundServicePluginLogic(27704): Action = getStatus
08-19 18:48:42.744: D/Cordova(27704): onPageFinished(file:///android_asset/www/index.html#comensa)
08-19 18:48:42.749: D/DroidGap(27704): onMessage(onPageFinished,file:///android_asset/www/index.html#comensa)
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Start of Execute
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Withing try block
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Finding servicename com.xxxxx.xxxxxx.XLocator
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Services contain 1 records
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Found existing Service Details
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Action = startService
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Starting startService
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Attempting to bind to Service
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Starting bindToService
08-19 18:48:42.759: D/BackgroundServicePluginLogic(27704): Attempting to start service
08-19 18:48:42.764: D/BackgroundServicePluginLogic(27704): Attempting to bind to service
08-19 18:48:42.769: D/BackgroundServicePluginLogic(27704): Waiting for service connected lock
08-19 18:48:42.779: I/BackgroundService(27704): Service creating
08-19 18:48:42.779: I/BackgroundService(27704): Initialising the service
08-19 18:48:42.779: I/BackgroundService(27704): Syncing result
08-19 18:48:42.784: I/BackgroundService(27704): Service started
08-19 18:48:42.784: I/BackgroundService(27704): onBind called
08-19 18:48:42.784: D/BackgroundService(27704): Listener added
08-19 18:48:42.784: D/BackgroundServicePluginLogic(27704): Finished bindToService
08-19 18:48:42.784: D/BackgroundServicePluginLogic(27704): Bind worked
08-19 18:48:42.809: D/BackgroundServicePluginLogic(27704): Finished startService
08-19 18:48:42.809: D/BackgroundServicePluginLogic(27704): Start of Execute
08-19 18:48:42.809: D/BackgroundServicePluginLogic(27704): Withing try block
08-19 18:48:42.809: D/BackgroundServicePluginLogic(27704): Finding servicename com.xxxxx.xxxxxx.XLocator
08-19 18:48:42.809: D/BackgroundServicePluginLogic(27704): Services contain 1 records
08-19 18:48:42.809: D/BackgroundServicePluginLogic(27704): Found existing Service Details
08-19 18:48:42.809: D/BackgroundServicePluginLogic(27704): Action = enableTimer
08-19 18:48:42.809: D/BackgroundServicePluginLogic(27704): Check if the service is running?
08-19 18:48:42.814: D/BackgroundServicePluginLogic(27704): Service is running?
08-19 18:48:42.814: I/BackgroundService(27704): stopTimerTask called
08-19 18:48:43.839: I/BackgroundService(27704): Timer task starting work
08-19 18:48:43.839: D/BackgroundService(27704): Is the service paused?
08-19 18:48:43.839: D/BackgroundService(27704): Service is not paused
08-19 18:48:43.839: I/BackgroundService(27704): Syncing result
08-19 18:48:43.839: I/BackgroundService(27704): Sending to all listeners
08-19 18:48:43.839: D/ServiceDetails(27704): Latest results received
08-19 18:48:43.839: D/ServiceDetails(27704): No action performed
08-19 18:48:43.839: I/BackgroundService(27704): Sent listener - 0
08-19 18:48:43.839: I/BackgroundService(27704): Timer task completing work
08-19 18:48:51.924: D/Cordova(27704): onPageFinished(file:///android_asset/www/index.html#login)
08-19 18:48:51.924: D/DroidGap(27704): onMessage(onPageFinished,file:///android_asset/www/index.html#login)
08-19 18:48:53.324: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:48:53.469: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:49:03.864: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:49:03.899: W/IInputConnectionWrapper(27704): getTextBeforeCursor on inactive InputConnection
08-19 18:49:03.914: W/IInputConnectionWrapper(27704): getTextAfterCursor on inactive InputConnection
08-19 18:49:05.879: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:49:07.519: W/IInputConnectionWrapper(27704): getTextBeforeCursor on inactive InputConnection
08-19 18:49:07.524: W/IInputConnectionWrapper(27704): getTextAfterCursor on inactive InputConnection
08-19 18:49:07.574: W/IInputConnectionWrapper(27704): getTextBeforeCursor on inactive InputConnection
08-19 18:49:07.689: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:49:14.459: D/Cordova(27704): onPageFinished(file:///android_asset/www/index.html#perfil)
08-19 18:49:14.459: D/DroidGap(27704): onMessage(onPageFinished,file:///android_asset/www/index.html#perfil)
08-19 18:49:14.554: D/BackgroundServicePluginLogic(27704): Start of Execute
08-19 18:49:14.554: D/BackgroundServicePluginLogic(27704): Withing try block
08-19 18:49:14.554: D/BackgroundServicePluginLogic(27704): Finding servicename com.xxxxx.xxxxxx.XLocator
08-19 18:49:14.554: D/BackgroundServicePluginLogic(27704): Services contain 1 records
08-19 18:49:14.554: D/BackgroundServicePluginLogic(27704): Found existing Service Details
08-19 18:49:14.554: D/BackgroundServicePluginLogic(27704): Action = setConfiguration
08-19 18:49:14.554: D/BackgroundServicePluginLogic(27704): Check if the service is running?
08-19 18:49:14.559: D/BackgroundServicePluginLogic(27704): Service is running?
08-19 18:49:14.619: D/dalvikvm(27704): GC_CONCURRENT freed 921K, 9% free 13247K/14400K, paused 9ms+2ms, total 42ms
08-19 18:49:17.924: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:49:19.564: D/dalvikvm(27704): GC_FOR_ALLOC freed 3400K, 28% free 10500K/14464K, paused 17ms, total 17ms
08-19 18:49:19.629: D/dalvikvm(27704): GC_CONCURRENT freed 64K, 25% free 10935K/14464K, paused 3ms+8ms, total 34ms
08-19 18:49:30.424: D/CordovaWebView(27704): The current URL is: file:///android_asset/www/index.html#perfil
08-19 18:49:30.424: D/CordovaWebView(27704): The URL at item 0 is:file:///android_asset/www/index.html#comensa
08-19 18:49:30.444: D/DroidGap(27704): onMessage(exit,null)
08-19 18:49:30.459: D/DroidGap(27704): Paused the application!
08-19 18:49:30.699: W/IInputConnectionWrapper(27704): showStatusIcon on inactive InputConnection
08-19 18:49:31.114: D/DroidGap(27704): onDestroy()
08-19 18:49:31.114: D/CordovaWebView(27704): >>> loadUrl(javascript:try{cordova.require('cordova/channel').onDestroy.fire();}catch(e){console.log('exception firing destroy event from native');};)
08-19 18:49:31.114: D/PluginManager(27704): init()
08-19 18:49:31.129: D/BackgroundServicePluginLogic(27704): On Destroy Start
08-19 18:49:31.129: D/BackgroundServicePluginLogic(27704): Checking for services
08-19 18:49:31.129: D/BackgroundServicePluginLogic(27704): Found services
08-19 18:49:31.139: D/BackgroundServicePluginLogic(27704): Calling service.close()
08-19 18:49:31.139: D/ServiceDetails(27704): Close called
08-19 18:49:31.144: D/ServiceDetails(27704): Removing ServiceListener
08-19 18:49:31.144: D/BackgroundService(27704): Listener removed
08-19 18:49:31.149: D/ServiceDetails(27704): Removing ServiceConnection
08-19 18:49:31.169: D/ServiceDetails(27704): start of isServiceRunning
08-19 18:49:31.169: D/BackgroundServicePluginLogic(27704): On Destroy Finish
08-19 18:49:31.179: D/CordovaWebView(27704): >>> loadUrlNow()
08-19 18:49:31.904: D/DroidGap(27704): DroidGap.onCreate()
08-19 18:49:31.904: D/DroidGap(27704): Setting integer properties in DroidGap will be deprecated in 3.1 on August 2013, please use config.xml
08-19 18:49:31.919: D/CordovaWebView(27704): CordovaWebView is running on device made by: unknown
08-19 18:49:31.919: D/JsMessageQueue(27704): Set native->JS mode to 2
08-19 18:49:31.919: D/DroidGap(27704): DroidGap.init()
08-19 18:49:31.974: D/dalvikvm(27704): GC_FOR_ALLOC freed 31K, 25% free 10967K/14460K, paused 23ms, total 23ms
08-19 18:49:31.984: I/dalvikvm-heap(27704): Grow heap (frag case) to 13.374MB for 2764816-byte allocation
08-19 18:49:32.019: D/dalvikvm(27704): GC_FOR_ALLOC freed 6K, 21% free 13660K/17164K, paused 34ms, total 34ms
08-19 18:49:32.059: D/dalvikvm(27704): GC_CONCURRENT freed 4K, 21% free 13656K/17164K, paused 7ms+4ms, total 40ms
08-19 18:49:32.099: D/CordovaWebView(27704): DroidGap.loadUrl(file:///android_asset/www/index.html, 10000)
08-19 18:49:32.099: D/DroidGap(27704): onMessage(splashscreen,show)
08-19 18:49:32.099: D/CordovaWebView(27704): >>> loadUrl(file:///android_asset/www/index.html)
08-19 18:49:32.099: D/PluginManager(27704): init()
08-19 18:49:32.109: D/CordovaWebView(27704): >>> loadUrlNow()
08-19 18:49:32.114: D/DroidGap(27704): Resuming the App
08-19 18:49:32.164: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:49:32.194: D/DroidGap(27704): onMessage(onPageStarted,file:///android_asset/www/index.html)
08-19 18:49:32.259: D/SoftKeyboardDetect(27704): Ignore this event
08-19 18:49:32.424: D/chromium(27704): Unknown chromium error: -6
08-19 18:49:32.464: D/CordovaNetworkManager(27704): Connection Type: wifi
08-19 18:49:32.464: D/CordovaNetworkManager(27704): Connection Type: wifi
08-19 18:49:32.464: D/DroidGap(27704): onMessage(networkconnection,wifi)
08-19 18:49:32.464: D/DroidGap(27704): onMessage(spinner,stop)
08-19 18:49:32.994: D/Cordova(27704): onPageFinished(file:///android_asset/www/index.html#perfil)
08-19 18:49:32.994: D/DroidGap(27704): onMessage(onPageFinished,file:///android_asset/www/index.html#perfil)
08-19 18:49:32.999: D/Cordova(27704): onPageFinished(file:///android_asset/www/index.html#perfil)
08-19 18:49:32.999: D/DroidGap(27704): onMessage(onPageFinished,file:///android_asset/www/index.html#perfil)
08-19 18:49:33.049: D/BackgroundServicePluginLogic(27704): Start of Execute
08-19 18:49:33.054: D/BackgroundServicePluginLogic(27704): Withing try block
08-19 18:49:33.054: D/BackgroundServicePluginLogic(27704): Finding servicename com.xxxxx.xxxxxx.XLocator
08-19 18:49:33.054: D/BackgroundServicePluginLogic(27704): Services contain 0 records
08-19 18:49:33.054: D/BackgroundServicePluginLogic(27704): Creating new Service Details
08-19 18:49:33.054: D/BackgroundServicePluginLogic(27704): Action = setConfiguration
08-19 18:49:33.059: D/BackgroundServicePluginLogic(27704): Starting startService
08-19 18:49:33.059: D/BackgroundServicePluginLogic(27704): Attempting to bind to Service
08-19 18:49:33.059: D/BackgroundServicePluginLogic(27704): Starting bindToService
08-19 18:49:33.059: D/BackgroundServicePluginLogic(27704): Attempting to start service
08-19 18:49:33.059: I/BackgroundService(27704): Service started
08-19 18:49:33.059: D/BackgroundServicePluginLogic(27704): Attempting to bind to service
08-19 18:49:33.069: D/BackgroundService(27704): Listener added
08-19 18:49:33.069: D/BackgroundServicePluginLogic(27704): Waiting for service connected lock
08-19 18:49:33.069: D/BackgroundServicePluginLogic(27704): Finished bindToService
08-19 18:49:33.069: D/BackgroundServicePluginLogic(27704): Bind worked
08-19 18:49:33.124: I/App(27704): WARNING: Back Button Default Behaviour will be overridden. The backbutton event will be fired!
08-19 18:49:33.144: D/DroidGap(27704): onMessage(splashscreen,hide)
08-19 18:49:33.544: D/DroidGap(27704): onMessage(splashscreen,hide)
08-19 18:49:33.549: D/BackgroundServicePluginLogic(27704): Start of Execute
08-19 18:49:33.549: D/BackgroundServicePluginLogic(27704): Withing try block
08-19 18:49:33.549: D/BackgroundServicePluginLogic(27704): Finding servicename com.xxxxx.xxxxxx.XLocator
08-19 18:49:33.554: D/BackgroundServicePluginLogic(27704): Services contain 1 records
08-19 18:49:33.554: D/BackgroundServicePluginLogic(27704): Found existing Service Details
08-19 18:49:33.554: D/BackgroundServicePluginLogic(27704): Action = getStatus
08-19 18:49:34.704: D/BackgroundServicePluginLogic(27704): Finished startService
08-19 18:49:34.709: D/BackgroundServicePluginLogic(27704): Check if the service is running?
08-19 18:49:34.709: D/BackgroundServicePluginLogic(27704): Service is running?
08-19 18:49:51.184: E/CordovaWebView(27704): CordovaWebView: TIMEOUT ERROR!
08-19 18:49:51.189: D/Cordova(27704): CordovaWebViewClient.onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=javascript:try{cordova.require('cordova/channel').onDestroy.fire();}catch(e){console.log('exception firing destroy event from native');};
08-19 18:49:51.219: D/DroidGap(27704): onMessage(onReceivedError,{"errorCode":-6,"url":"javascript:try{cordova.require('cordova/channel').onDestroy.fire();}catch(e){console.log('exception firing destroy event from native');};","description":"The connection to the server was unsuccessful."})
08-19 18:49:51.409: D/dalvikvm(27704): GC_CONCURRENT freed 583K, 17% free 14391K/17160K, paused 13ms+11ms, total 81ms
08-19 18:49:51.409: D/dalvikvm(27704): WAIT_FOR_CONCURRENT_GC blocked 4ms
08-19 18:50:14.619: D/BackgroundServicePluginLogic(27704): Start of Execute
08-19 18:50:14.619: D/BackgroundServicePluginLogic(27704): Withing try block
08-19 18:50:14.619: D/BackgroundServicePluginLogic(27704): Finding servicename com.xxxxx.xxxxxx.XLocator
08-19 18:50:14.619: D/BackgroundServicePluginLogic(27704): Services contain 0 records
08-19 18:50:14.619: D/BackgroundServicePluginLogic(27704): Creating new Service Details
08-19 18:50:14.624: D/BackgroundServicePluginLogic(27704): Action = setConfiguration
08-19 18:50:14.644: D/BackgroundServicePluginLogic(27704): Starting startService
08-19 18:50:14.644: D/BackgroundServicePluginLogic(27704): Attempting to bind to Service
08-19 18:50:14.644: D/BackgroundServicePluginLogic(27704): Starting bindToService
08-19 18:50:14.644: D/BackgroundServicePluginLogic(27704): Attempting to start service
08-19 18:50:14.649: I/BackgroundService(27704): Service started
08-19 18:50:14.654: D/BackgroundServicePluginLogic(27704): Attempting to bind to service
08-19 18:50:14.659: D/BackgroundServicePluginLogic(27704): Finished bindToService
08-19 18:50:14.659: D/BackgroundServicePluginLogic(27704): Bind Failed
08-19 18:50:14.674: D/BackgroundServicePluginLogic(27704): Finished startService
08-19 18:50:14.679: D/BackgroundServicePluginLogic(27704): Check if the service is running?
08-19 18:50:14.684: D/BackgroundServicePluginLogic(27704): Service is running?
08-19 18:50:14.699: D/BackgroundServicePluginLogic(27704): Exception - null
08-19 18:50:14.719: W/dalvikvm(27704): threadid=23: thread exiting with uncaught exception (group=0x4123a930)
08-19 18:50:14.719: E/AndroidRuntime(27704): FATAL EXCEPTION: pool-1-thread-1
08-19 18:50:14.719: E/AndroidRuntime(27704): java.lang.NullPointerException
08-19 18:50:14.719: E/AndroidRuntime(27704): at org.apache.cordova.api.PluginResult.(PluginResult.java:52)
08-19 18:50:14.719: E/AndroidRuntime(27704): at org.apache.cordova.api.CallbackContext.error(CallbackContext.java:107)
08-19 18:50:14.719: E/AndroidRuntime(27704): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin$1.run(BackgroundServicePlugin.java:55)
08-19 18:50:14.719: E/AndroidRuntime(27704): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
08-19 18:50:14.719: E/AndroidRuntime(27704): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
08-19 18:50:14.719: E/AndroidRuntime(27704): at java.lang.Thread.run(Thread.java:856)
08-19 18:50:14.759: D/DroidGap(27704): Paused the application!
08-19 18:50:14.759: D/CordovaWebView(27704): Handle the pause
08-19 18:50:14.769: D/BackgroundServicePluginLogic(27704): Start of Execute
08-19 18:50:14.769: D/BackgroundServicePluginLogic(27704): Withing try block
08-19 18:50:14.774: D/BackgroundServicePluginLogic(27704): Finding servicename com.xxxxx.xxxxxx.XLocator
08-19 18:50:14.774: D/BackgroundServicePluginLogic(27704): Services contain 1 records
08-19 18:50:14.774: D/BackgroundServicePluginLogic(27704): Found existing Service Details
08-19 18:50:14.774: D/BackgroundServicePluginLogic(27704): Action = setConfiguration
08-19 18:50:14.774: D/BackgroundServicePluginLogic(27704): Check if the service is running?
08-19 18:50:14.794: D/BackgroundServicePluginLogic(27704): Service is running?
08-19 18:50:15.464: D/DroidGap(27704): onDestroy()
08-19 18:50:15.464: D/CordovaWebView(27704): >>> loadUrl(javascript:try{cordova.require('cordova/channel').onDestroy.fire();}catch(e){console.log('exception firing destroy event from native');};)
08-19 18:50:15.464: D/PluginManager(27704): init()
08-19 18:50:15.464: D/BackgroundServicePluginLogic(27704): On Destroy Start
08-19 18:50:15.464: D/BackgroundServicePluginLogic(27704): Checking for services
08-19 18:50:15.464: D/BackgroundServicePluginLogic(27704): Found services
08-19 18:50:15.464: D/BackgroundServicePluginLogic(27704): Calling service.close()
08-19 18:50:15.464: D/ServiceDetails(27704): Close called
08-19 18:50:15.464: D/ServiceDetails(27704): Removing ServiceListener
08-19 18:50:15.464: D/BackgroundService(27704): Listener removed
08-19 18:50:15.464: D/ServiceDetails(27704): Removing ServiceConnection
08-19 18:50:15.464: D/ServiceDetails(27704): start of isServiceRunning
08-19 18:50:15.464: D/BackgroundServicePluginLogic(27704): On Destroy Finish
08-19 18:50:15.464: D/CordovaWebView(27704): >>> loadUrlNow()
08-19 18:50:16.814: I/Process(27704): Sending signal. PID: 27704 SIG: 9
08-19 18:50:22.254: D/Xmile APID(28094): eb21b9db-ed55-41da-bbfe-cc9cbabd0fa9
08-19 18:50:22.279: I/BackgroundService(28094): Service creating
08-19 18:50:22.279: I/BackgroundService(28094): Initialising the service
08-19 18:50:22.279: I/BackgroundService(28094): Syncing result
08-19 18:50:22.294: I/BackgroundService(28094): Service started
08-19 18:50:22.309: D/dalvikvm(28094): GC_CONCURRENT freed 267K, 3% free 9841K/10136K, paused 3ms+5ms, total 25ms
08-19 18:50:23.294: I/BackgroundService(28094): Timer task starting work
08-19 18:50:23.294: D/BackgroundService(28094): Is the service paused?
08-19 18:50:23.294: D/BackgroundService(28094): Service is not paused
08-19 18:50:23.839: I/BackgroundService(28094): Syncing result
08-19 18:50:23.844: I/BackgroundService(28094): Sending to all listeners
08-19 18:50:23.844: I/BackgroundService(28094): Timer task completing work

@Red-Folder
Copy link
Owner

The null exception is being triggered by a "null" response coming out of BackgroundServicePluginLogic.Execute

That response is being fed back to the Cordova PluginResult and blowing up.

The null is coming out of BackgroundServicePluginLogic.Execute because an exception is being thrown, but being caught within the try/ catch of the Execute method.

So two problems here:

  1. BackgroundServicePluginLogic.Execute needs to ensure that it never leave the result as null. I'll need to provide out a Unknown or similar - just make sure that it doesn't return null and cause an unhanded exception.

  2. The real problem - need to understand why we are getting an exception in the first place. If you see the above, we have:

08-19 18:50:14.699: D/BackgroundServicePluginLogic(27704): Exception - null

I would have expected a meaningful message rather than null - so that's a bit of a problem. I believe this comment is being written by line 171 of the Execute.

@Red-Folder
Copy link
Owner

@greips

The error seems to occur after a call to setConfiguration

Can you provide me with the JavaScript code that you are using to call it (what values are passed in etc)

Also, assuming you are linking to your own backgroundservice, can provide me you java implementation of setConfiguration

I suspect that there is something amiss with the Javascript parameters being passed into setConfiguration.

(Note that that doesn't excuse my code from behaving poorly and throwing an exception)

@greips
Copy link

greips commented Aug 21, 2013

@Red-Folder
Don't blame yourself as the error is probably on my side as no one else seems to be experencing problems :'(

My code is pretty standard:

@OverRide
protected void setConfig(JSONObject config) {
try {
if (config.has("id")&&(config.has("uuid"))) {
this.mId = config.getString("id");
this.mUuid = config.getString("uuid");
}
} catch (JSONException e) {
//Log.d(TAG,"Error");
}

}

And the javascript call is:

    function setConfig() {
        user="x";
                    uuid="y";

        if (user&&uuid) {
            var config = { 
                            "id" : user,    
                            "uuid" : uuid
                        }; 
            XLocator.setConfiguration(config,
                        function(r){/*console.log("setconfig ok")*/},
                        function(e){console.log("error setconfig") });
        }
    }

The only weird thing is that I call the setconfig() function once every minute using a setInterval() function. I guess the problem is there...

@greips
Copy link

greips commented Aug 21, 2013

I've removed the setconfig() from the setInterval() function and now everything seems to run smoothly :)

@Red-Folder
Copy link
Owner

@greips What interval did you have setup? Also, within the interval callback are you calling setConfig & getStatus?

There is obviously an underlying issue. You should be able to call the setConfig multiple times.

I suspect there is either an issue with overlapping calls to the background service or it's a threading problem within the setConfig in the BackgroundService

@greips
Copy link

greips commented Aug 22, 2013

@Red-Folder
I was calling the setConfig once every minute or so. And no, I wasn't calling the getStatus because I thought it wasn't necessary...

Yes, I thing something is wrong somewhere, but I couldn't find it. I suspect it is somehow related to the binding, because everytime it failed the bind had been failed.

@Red-Folder
Copy link
Owner

I'll have to spend some time trying to break it when I get a chance. I'll need to build an app which consistently fails.

Any further info you can provide is greatly appreciated.

@greips
Copy link

greips commented Aug 22, 2013

Well, actually I had this javascript code at the pageshow of a jquerymobile page:

setInterval(function(){setConfig();},60000);

Maybe if you try to put this at the onLoad() you might reproduce the npe...

@Red-Folder
Copy link
Owner

Great news on this issue.

From the above and issue #13 - it really does seem as if the problem is related to concurrent calls to the BackgroundService.

In "expected" use this shouldn't occur because you would call one plugin method, then wait for success (or failure) callback before calling the next plugin method.

However, there is nothing in the Plugin to defend against unexpected (by me) use and multiple calls occurring in parallel.

Looks as if I need to put some defensive programming into the Plugin to avoid multiple calls being made to the BackgroundService in parallel (maybe a queue system).

I'll have to produce some tests so that I definitely prove this ... but at least I've got a good place to start ... and I can provide advice to anyone hitting the error.

@Red-Folder
Copy link
Owner

I'm able to get the error in my code with the following:

        setInterval(function() { 
            myService.setConfiguration( { "HelloTo" : "World" },
                                        function(data){},
                                        function(data){});
                    },
                    1000);

        myService.startService( function(data) {
                                    returnedData = data;
                                    flag = true;
                                },
                                function(data) {
                                    returnedData = data;
                                    flag = true;
                                });

The error will then occur if I close the app, giving the below in the logcat:

08-28 21:37:44.826: D/BackgroundServicePluginLogic(1040): Bind Failed
08-28 21:37:44.834: D/BackgroundServicePluginLogic(1040): Finished startService
08-28 21:37:44.834: D/BackgroundServicePluginLogic(1040): Check if the service is running?
08-28 21:37:44.845: D/BackgroundServicePluginLogic(1040): Service is running?
08-28 21:37:44.845: D/BackgroundServicePluginLogic(1040): Exception - null
08-28 21:37:44.854: W/dalvikvm(1040): threadid=11: thread exiting with uncaught exception (group=0x4001d800)
08-28 21:37:44.865: E/AndroidRuntime(1040): FATAL EXCEPTION: pool-1-thread-1
08-28 21:37:44.865: E/AndroidRuntime(1040): java.lang.NullPointerException
08-28 21:37:44.865: E/AndroidRuntime(1040): at org.apache.cordova.api.PluginResult.(PluginResult.java:52)
08-28 21:37:44.865: E/AndroidRuntime(1040): at org.apache.cordova.api.CallbackContext.error(CallbackContext.java:107)
08-28 21:37:44.865: E/AndroidRuntime(1040): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin$1.run(BackgroundServicePlugin.java:55)
08-28 21:37:44.865: E/AndroidRuntime(1040): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
08-28 21:37:44.865: E/AndroidRuntime(1040): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
08-28 21:37:44.865: E/AndroidRuntime(1040): at java.lang.Thread.run(Thread.java:1096)

@Red-Folder
Copy link
Owner

I'll have a look over the next couple days to how to protect against the exception

@teusink
Copy link
Author

teusink commented Aug 28, 2013

Kk thanks. If I can help, let me know!

www.teusink.org
www.droidpapers.org
Op 28 aug. 2013 21:48 schreef "Red-Folder" [email protected] het
volgende:

I'll have a look over the next couple days to how to protect against the
exception


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-23442080
.

@Red-Folder
Copy link
Owner

If you find any other ways to cause the error - that would be great
On 28 Aug 2013 22:19, "Joram Teusink" [email protected] wrote:

Kk thanks. If I can help, let me know!

www.teusink.org
www.droidpapers.org
Op 28 aug. 2013 21:48 schreef "Red-Folder" [email protected] het
volgende:

I'll have a look over the next couple days to how to protect against the
exception


Reply to this email directly or view it on GitHub<
https://github.com/Red-Folder/Cordova-Plugin-BackgroundService/issues/7#issuecomment-23442080>

.


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-23448532
.

@greips
Copy link

greips commented Aug 29, 2013

@Red-Folder That's great man! 👍

@Red-Folder
Copy link
Owner

Committed and published changes (4ef7fb3)

Fingers crossed it's all fixed

@greips
Copy link

greips commented Sep 4, 2013

Great! 👍

@teusink
Copy link
Author

teusink commented Sep 6, 2013

Thanks! 👍

@amusmani
Copy link

@Red-Folder Kindly guide me why this error occured , i m stuck in this for last 3 days. This exception occured when i try do
String android_id = Secure.getString(getBaseContext().getContentResolver(), Secure.ANDROID_ID);

09-30 09:46:49.245: E/AndroidRuntime(7168): FATAL EXCEPTION: pool-1-thread-2
09-30 09:46:49.245: E/AndroidRuntime(7168): java.lang.NullPointerException
09-30 09:46:49.245: E/AndroidRuntime(7168): at org.apache.cordova.api.PluginResult.(PluginResult.java:52)
09-30 09:46:49.245: E/AndroidRuntime(7168): at org.apache.cordova.api.CallbackContext.error(CallbackContext.java:125)
09-30 09:46:49.245: E/AndroidRuntime(7168): at com.red_folder.phonegap.plugin.backgroundservice.BackgroundServicePlugin$1.run(BackgroundServicePlugin.java:55)
09-30 09:46:49.245: E/AndroidRuntime(7168): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-30 09:46:49.245: E/AndroidRuntime(7168): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-30 09:46:49.245: E/AndroidRuntime(7168): at java.lang.Thread.run(Thread.java:856)

@Red-Folder
Copy link
Owner

@amusmani Please do not tag questions onto old closed issues - create a new one.

Assuming you still have the problem, then I'll look at it once your created a new issue

@vladjiss
Copy link

Please help me, I have a error: Error: Plugin unable to bind to background servace
ErrorCode: -4 ...
I do everything according to instructions.
http://zalivalka.ru/79472

@vladjiss
Copy link

Please help me, I have a error: Error: Plugin unable to bind to background servace
ErrorCode: -4 ...
I do everything according to instructions.
http://zalivalka.ru/79472
Who has a working source code, send me please [email protected]

@Red-Folder
Copy link
Owner

@vladjiss Please do not add comments to closed issues. If you have an issue please create a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants