-
Notifications
You must be signed in to change notification settings - Fork 85
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
Comments
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. |
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. |
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? |
My app is DroidPapers (did I reply o this by emai btw?). Are you going to compile it against 2.9.0? |
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. |
Hi. No worries and no rush and thanks in advance! :) |
using 2.9.0, facing the same problem |
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? |
hi.. sorry for my late reply |
Hi @Red-Folder , |
Please post it here in the issue |
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 |
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:
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. |
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) |
@Red-Folder My code is pretty standard: @OverRide
And the javascript call is:
The only weird thing is that I call the setconfig() function once every minute using a setInterval() function. I guess the problem is there... |
I've removed the setconfig() from the setInterval() function and now everything seems to run smoothly :) |
@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 |
@Red-Folder 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. |
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. |
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... |
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. |
I'm able to get the error in my code with the following:
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 |
I'll have a look over the next couple days to how to protect against the exception |
Kk thanks. If I can help, let me know! www.teusink.org
|
If you find any other ways to cause the error - that would be great
|
@Red-Folder That's great man! 👍 |
Committed and published changes (4ef7fb3) Fingers crossed it's all fixed |
Great! 👍 |
Thanks! 👍 |
@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 09-30 09:46:49.245: E/AndroidRuntime(7168): FATAL EXCEPTION: pool-1-thread-2 |
@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 |
Please help me, I have a error: Error: Plugin unable to bind to background servace |
Please help me, I have a error: Error: Plugin unable to bind to background servace |
@vladjiss Please do not add comments to closed issues. If you have an issue please create a new one. |
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)
The text was updated successfully, but these errors were encountered: