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

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#
Onik Reply to 2018-01-14 14:31:08Z

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.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.337736 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO