How can I start and stop service from notification just by tapping it(No button), I somehow managed to start the pending intent, but don't know where to put stop service()/stopself() command.
PendingIntent pi = PendingIntent.getService(MainActivity.this,0, new Intent(MainActivity.this, MainService.class), 0);
final Notification notification = new NotificationCompat.Builder(MainActivity.this)
.setTicker("MY FIRST NOTIFICATION TOGGLE")
.setSmallIcon(R.drawable.ic_blur_on_black_24dp)
.setContentTitle("Click to toggle on/off")
.setContentText("Click Again")
.setContentIntent(pi)
.setOngoing(true)
.build();
final NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);