-
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
LogCat messages: "Plugin should use CordovaInterface.getThreadPool()" #19
Comments
I have seen this warning message before ... however I don't believe I can do any further work to improve it. The code is already using getThreadPool and follows the pattern as described here (see the getThreadPool example) -> http://docs.phonegap.com/en/2.7.0/guide_plugin-development_android_index.md.html#Developing%20a%20Plugin%20on%20Android If you look at the code within the source repository (https://github.com/Red-Folder/Cordova-Plugin-BackgroundService-Source/tree/master/src/com/red_folder/phonegap/plugin/backgroundservice). The difference is that the logic split into a separate class to allow it to be decorated with the appropriate interface. I've possibly got something wrong in the threading logic - but I'm afraid I can't spot it. I'm open to suggestions. |
Having done some further research I wonder if it is related to the variables (used in the run) not being final. See this article -> http://stackoverflow.com/questions/11424753/why-do-variables-passed-to-runnable-need-to-be-final |
I've tried some changes - but that's completely broken it ;) I'll review the changes over the next couple of days .... but this "final" may well be a red herring. |
Your efforts are very much appreciated. Interesting, although a little over my head. The phonegap example does seem to point towards your point about final as the line before the getThreadPool() call is; final long duration = args.getLong(0); Im polling the getStatus regularly (5 second interval) from the UI. Maybe i need to reduce this to help work around the problem. Is there a better way to for the UI to be notified of new data from the service? I.e. having the service invoke somesort of callback to the UI when it has something to say, rather than the UI keeping polling a question. |
I have another issue raised (#17) which asks for the Plugin to push the latest results to the HTML/ JavaScript. When this is done, you should be able to remove the getStatus every 5 seconds. I hope to get to that issue in the next couple of weeks. |
Awesome. I'll test that out when i can get back onto that project |
Issue moved to Red-Folder/bgs-core#26 |
Hello,
Thanks for a great plugin.
I've noticed lots of these sorts of messages in my Logcat. All works fine, but think it could be causing some UI lag. Any suggestions?
THREAD WARNING: exec() call to BackgroundServicePlugin.getStatus blocked the main thread for 25ms. Plugin should use CordovaInterface.getThreadPool().
Phonegap v3.0
Android : 4.3
The text was updated successfully, but these errors were encountered: