In the development of the app, do not allow the music player to keep the music from playing even when the screen is locked. This requires
keeping the cpu awake during sleep to run the service, and the api in PowerManager.WakeLock can achieve this. Function
There are four levels of wake lock:
So if you want to keep the cpu awake, use PARTIAL_WAKE_LOCK
custom service
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;