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 -

c - Defining floating point constants, how many digits are useful? -