Forground Service get killed after Android Screen Unlock -
I'm playing music in the foreground service and it's surrounded with activity and when the activity is running the service does not kill on the screen Get down and again but when the activity is not visible, it means that the music is only going in the foreground service and the app is close, while the music is playing in the background and when I turn off the music then the music is going fine But when I unlock the screen
@ corsair992 Seeing this on the page given in the comment, I found this solution Solving the problem for me!
AlarmManager almgr = (AlarmManager) MyContext.getSystemService (reference .ALARM_SERVICE); Intent timer intent = new intent (MyUniqueLabel); TimerIntent.addFlags (Intent.FLAG_RECEIVER_FOREGROUND); Pending pending offloaded entity = pending .gatebrastro (miconnectext, 1, timercentant, 0); You can make these things necessary for working.
1.) Call AddFlags and Intentions and pass it to FLAG_RECEIVER_FORGROUND
2.) Use a non-zero request code in the Pending .tatebordest
< P> If you exit any of those steps, then this will not work.
Comments
Post a Comment