Fusseldieb Active Member Licensed User Longtime User Nov 16, 2014 #1 Hi all, I'm making Http-Post Requests on my app and receive them in the Sub "JobDone". How can I cancel the event, when the user presses the "BACK" button? Because if I don't cancel the Job and the user has already exited the Activity, the Activity re-opens and causes a bug opening and closing the Activity infinitely. Thanks in advance
Hi all, I'm making Http-Post Requests on my app and receive them in the Sub "JobDone". How can I cancel the event, when the user presses the "BACK" button? Because if I don't cancel the Job and the user has already exited the Activity, the Activity re-opens and causes a bug opening and closing the Activity infinitely. Thanks in advance
lemonisdead Well-Known Member Licensed User Longtime User Nov 16, 2014 #2 Hello, In the Activity_Pause when user close is true then Stopservice("httputils2service") should do it. http://www.b4x.com/android/forum/threads/chiusura-httputils2service.34919/#post-205792 Upvote 0
Hello, In the Activity_Pause when user close is true then Stopservice("httputils2service") should do it. http://www.b4x.com/android/forum/threads/chiusura-httputils2service.34919/#post-205792
Fusseldieb Active Member Licensed User Longtime User Nov 16, 2014 #3 lemonisdead said: Stopservice("httputils2service") should do it. Click to expand... It doesn't work. It gives me the error: java.lang.ClassNotFoundException: my.app.httputils2service Click to expand... EDIT: I am using: Code: Sub ExecuteRemoteQuery(query As String, JobName As String) Dim jobs As HttpJob jobs.Initialize(JobName, Me) jobs.PostString("XXXXXXXXXXXXXXXXX/include/config.php", query) End Sub EDITIT: I have now used: Code: StopService(HttpUtils2Service) But when I press the back button and the app passes through this code, the app crashes with an NullPointerException. Last edited: Nov 16, 2014 Upvote 0
lemonisdead said: Stopservice("httputils2service") should do it. Click to expand... It doesn't work. It gives me the error: java.lang.ClassNotFoundException: my.app.httputils2service Click to expand... EDIT: I am using: Code: Sub ExecuteRemoteQuery(query As String, JobName As String) Dim jobs As HttpJob jobs.Initialize(JobName, Me) jobs.PostString("XXXXXXXXXXXXXXXXX/include/config.php", query) End Sub EDITIT: I have now used: Code: StopService(HttpUtils2Service) But when I press the back button and the app passes through this code, the app crashes with an NullPointerException.
lemonisdead Well-Known Member Licensed User Longtime User Nov 17, 2014 #4 Excuse me, I am sorry. Don't you use httputils2 ? It has a function to cancel http://www.b4x.com/android/forum/threads/download-huge-files-with-httputils2.30220/ Upvote 0
Excuse me, I am sorry. Don't you use httputils2 ? It has a function to cancel http://www.b4x.com/android/forum/threads/download-huge-files-with-httputils2.30220/
DonManfred Expert Licensed User Longtime User Nov 17, 2014 #5 i dont think that he is using the httputils2-SERVICE. I believe he uses the normal httputils2-lib (not the service) Upvote 0
i dont think that he is using the httputils2-SERVICE. I believe he uses the normal httputils2-lib (not the service)
Erel B4X founder Staff member Licensed User Longtime User Nov 17, 2014 #6 The correct solution is to use a service to manage the downloads. This way you will be able to decide whether to show the activity or not. Upvote 0
The correct solution is to use a service to manage the downloads. This way you will be able to decide whether to show the activity or not.