Thursday, February 21, 2013

Re: RPC call in Activity onStop()

Sorry for my late reaction.
Indeed I don't need the callback, I just need to send a "terminates" message to the server to release some temporary work data.
As it didn't worked, I removed this part of the code, so I can't give right now an example. But the fact is that the server didn't received the call (checked with a lot of debug logs and breakpoints).
I'll try again, also with the addClosingHandler() which I didn't knew.
Thanks for the suggestion.
I'll come back soon.
Yves

Le mardi 19 février 2013 23:45:32 UTC+1, Jens a écrit :
I don't see why it should not work. You can do an RPC request in Activity.onStop() but you have to be aware of the fact that the activity will continue to stop while the request is pending. So your request's callback should not do anything that depends on the activity state or its view (which will be detached after the activity is stopped).

You can also do a RPC request in Window.addClosingHandler() which will be called before the window/tab gets closed. But again in this case the callback is probably never called as the window/tab gets closed while the request is pending. All you could do here is telling the server that the app "terminates" now and let the server invalidate the users session for example.

Have you checked FireBug/Chrome Devtools and verified that no last request is made?

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment