I have an app with a background process running with a notification image on top of it. I want to close the app by clicking a button inside of the App. Currently I have to force close it from the settings. What do I have to change in the code bellow to achieve this?
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.addCategory( Intent.CATEGORY_HOME );
The three codes above closes the app but the background process with the notication image is still running.
For remove top notification
notification.flags |= Notification.FLAG_AUTO_CANCEL; resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
For stop service :
In service class :