Android M keep killing foreground service
<p>Why my running service keep being killed on Android Marshmallow while it work normal on 4.x, 5.x
I created extended service + notification and run it as foreground.
However it always being stopped after about 5 minutes (also, notification gone).</p>

<pre><code>startForeground(1337, notification);
</code></pre>

<p>What is the correct method to keep the service running without being killed on android 6.x? Thank you</p>