# Background Playing
ByteArk Player SDK for Android supports continuing audio playback when the user switches apps or locks the screen, via withBackgroundPlaying() on ByteArkPlayerBuilder.
# Usage
val playerBuilder = ByteArkPlayerBuilder.Builder()
.withContext(this)
.withControl()
.withBackgroundPlaying()
.build()
1
2
3
4
5
2
3
4
5
You also need to declare the FOREGROUND_SERVICE permission and ByteArkPlayerService in AndroidManifest.xml:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application>
<service
android:name="com.byteark.bytearkplayercore.handler.exoplayer.service.ByteArkPlayerService"
android:enabled="true"
android:exported="true"/>
</application>
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Note
When playing in the background the player shows a Media notification so the viewer can control playback from the notification panel.