I followed RadioPlayerService as a example to Create radio stream in android
I have added the below code to exit in RadioActivity.java
@Override
public void onBackPressed() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
alertDialogBuilder.setTitle("Exit ! Radio App.");
alertDialogBuilder
.setMessage("Click Yes to Exit!")
.setCancelable(false)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
moveTaskToBack(true);
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
}
Here My app is exiting but the notification is working this is my notification class
Can any one suggest me How to kill entire app on exit
Or combine both notification service and main activity so that I can exit the app completely
This is the full reference code
Can any one suggest me on this kind
Update 1
I am giving exit option in main activity not in other service
my main activity is RadioActivity.java
and my service is RadioPlayerService.java
So here I am giving Exit to main activity so I what i need means instead of exiting main activity It should exit entire app including service.
Don't down-vote without comment don't comment without seeing full sourcode ..
Thanks again