Android Question Application not responding

Discussion in 'Android Questions' started by dieterp, Mar 5, 2015.

  1. dieterp

    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
     
  2. KMatle

    KMatle Expert Licensed User

    Without seeing the code: Nope
     
    eps likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    You should also post the logs. There might be more information there.

    Make sure not to call DoEvents after you call CallSubDelayed or in Service_Create code.
     
  4. cyiwin

    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?
     
  5. dieterp

    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
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    No and No.

    It might be related.
     
    cyiwin likes this.
  7. dieterp

    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!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice