I Found some codes for quit an Android application programatically. By calling any one of the following code in onDestroy() will it quit application entirely?
@Sivi 's answer closes the app. But on return, if you have some child activities, another unfinished activity might be opened. I added noHistory:true to my activities so the app on return starts from MainActivity.