1

I know that I can kill a process when I press the red square button that is in the logcat (Having the corresponding device and process selected).

This image shows the way I use to kill an android process

However, when I do that the service is not restarted how I expect. It calls onCreate and onDestroy and it doesn't call onStartCommand despite the fact that the onStartCommand returns START_STICKY.

I show you my code and please if you have an idea of what the problem might be tell me

Service code to start a music

Martí Serra
  • 85
  • 1
  • 1
  • 6
  • You should include your code in the question within a code block instead of linking to a picture. – JerodG Feb 15 '20 at 13:36

3 Answers3

0

you need stop service:

Intent myService = new Intent(MainActivity.this, BackgroundSoundService.class);
stopService(myService);
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Durai
  • 59
  • 6
0

You better use Foreground Service for music playback.

Also, you should try killing your app like this

Phone Settings>Apps>your app> Force Stop

LutfiTekin
  • 441
  • 1
  • 10
  • 19
0

Have you declared service inside manifest file

Durai
  • 59
  • 6