content: package my.project.moviesbox.service;
  
  import android.app.Service;
  import android.content.Context;
  import android.content.Intent;
  import android.os.IBinder;
  import android.os.PowerManager;
  
  import androidx.annotation.Nullable;
  
  /**
   * @author Li
   * @version 1.0
   * @description: 注释
   * @date 2023/12/31 15:57
   */
  public class DLNAService extends Service {
      PowerManager.WakeLock wakeLock = null;
  
      @Nullable
      @Override
      public IBinder onBind(Intent intent) {
          return null;
      }
  
      @Override
      public int onStartCommand(Intent intent, int flags, int startId) {
          return super.onStartCommand(intent, flags, startId);
      }
  
      @Override
      public void onCreate() {
          super.onCreate();
          PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
          wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, DownloadService.class.getName());
          if (null != wakeLock) {
              wakeLock.acquire();
          }
      }
  
      @Override
      public void onDestroy() {
          if (wakeLock != null) {
              wakeLock.release();
              wakeLock = null;
          }
          super.onDestroy();
      }
  }
  