Home Must be one of: Service.START_STICKY_COMPATIBILITY, Service.START_STICKY, Service.START_NOT_STICKY, Service.START_REDELIVER_INTENT

# Must be one of: Service.START_STICKY_COMPATIBILITY, Service.START_STICKY, Service.START_NOT_STICKY, Service.START_REDELIVER_INTENT

Pavel Jan
1#
Pavel Jan Published in 2018-01-12 22:31:47Z
 When I have: public int onStartCommand(Intent intent, int flags, int startId) { try { player.start(); isRunning = true; } catch(Exception e) { isRunning = false; player.stop(); } return 1; }  I get the following "error" for return 1: Must be one of: Service.START_STICKY_COMPATIBILITY, Service.START_STICKY, Service.START_NOT_STICKY, Service.START_REDELIVER_INTENT How do I fix it?
Onik
2#
 If you meant to return START_STICKY, which is of type int equal to 1, from onStartCommand(...), you did nothing wrong. This is your IDE that prompts it. You can ignore the warning. In case of absence of other errors, your code will compile and run successfully. If the warning is annoying, return START_STICKY instead.