ondestroy() function is not called in TCL tab

20 Views Asked by At

In my android code ondestroy function not called when app is closed. I need to restart service class when close the app

@Override
    protected void onDestroy() {
        Toast.makeText(this, "Main Activity", Toast.LENGTH_SHORT).show();
    

        Intent broadcastIntent = new Intent();
        broadcastIntent.setAction("restartservice");
        broadcastIntent.setClass(this, Restarter.class);
        this.sendBroadcast(broadcastIntent);
        super.onDestroy();
    }

this works on other device.

0

There are 0 best solutions below