| | |
| | | public void onDestroy() { |
| | | removeAllCallback(); |
| | | logout(); |
| | | mCore.removeListener(mCoreListener); |
| | | mTimer.cancel(); |
| | | mCore.stop(); |
| | | // A stopped Core can be started again |
| | | // To ensure resources are freed, we must ensure it will be garbage collected |
| | | mCore = null; |
| | | |
| | | if(mTimer != null) { |
| | | mTimer.cancel(); |
| | | } |
| | | |
| | | if(mCore != null){ |
| | | mCore.removeListener(mCoreListener); |
| | | mCore.stop(); |
| | | // A stopped Core can be started again |
| | | // To ensure resources are freed, we must ensure it will be garbage collected |
| | | mCore = null; |
| | | } |
| | | // Don't forget to free the singleton as well |
| | | sInstance = null; |
| | | |