Android Question Application not responding

dieterp

Active Member
Licensed User
Hi Guys

I seem to be experiencing an 'Application not responding' message with my app. I have an activity module that starts a service that will upload data every 20 seconds. The 20 second timer only starts when I get a success message in JobDone that the last update was successful. Generally, it works without problems. Sometimes though, when I click the button to start the Service, it seems like it doesn't start the service or takes a long time to start the service, which eventually results in the 'Application not responding...' message.

I used to use 'StartService' to kick off the service, but recently started using 'CallSubDelayed', which calls a sub in the service that first checks for internet connection before doing any uploads (Thinking that may have been the issue). CallSubDelayed seems to have improved the situation, but I still get the 'Application not responding...' message sometimes.

I have put ToastMessages in to indicate when the Service is created and when it starts (And when the uploads begin). I do not see these messages appear when the problem occurs, which seems to infer that the service is not being created (Not straight away anyway). There is no other code in the activity module that could hold up the main thread for 5 seconds. It's basically just a button you push to start the service. Does anyone have any ideas for me? This is quite a big problem for me as the user also often get's a black screen to accompany the 'Application not responding...' message, which sometimes lasts for quite a while meaning they cannot continue.

It will be difficult for me to load the app up as it is a private business application. It is also difficult to emulate the problem as is it doesn't happen very often.

Regards
 

cyiwin

Active Member
Licensed User
Just a shot in the dark but is it possible the upload is huge? Or is that not a problem when using Httpjobs in a service module?
 

dieterp

Active Member
Licensed User
The upload isn't very large. I even made it smaller to check if that was causing the problem. It is just so random that 90% of the time it works without fail but other times it doesn't

Erel, I have been calling DoEvents after the CallSubDelayed. I read in a previous post that DoEvents could resolve the issue with someone else who was having a similar problem. Could that be the reason then that it wouldn't always work? I'll remove it and see if I still get the issue
 

dieterp

Active Member
Licensed User
I am happy to report that removing the DoEvents seems to have resolved the issue. Thanks for pointing that out Erel!
 
Top