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

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

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