java - How to run code when app is closed (force kill only) -


in application want client send message server when application closed, not when sent background.

onpause() not solution me, because means when activity goes background code execute.

i have tried ondestroy seems nothing @ all.

the relevant code:

public class chatactivity extends activity implements imessagelistener{  @override public void ondestroy() {     data.getmsger().sendmsglogout();     super.ondestroy(); } 

the code 'data.getmsger().sendmsglogout();' tries send message via socket, fails on ondestroy() event.

thank you.


Comments

Popular posts from this blog

c++ - list<myClass<int> * > sort -

SoapUI on windows 10 - high DPI/4K scaling issue -

java - why am i getting a "cannot resolve method" error on getApplication? -