DownServer.java 883 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.sunzee.service;
  2. import android.app.Service;
  3. import android.content.Context;
  4. import android.content.Intent;
  5. import android.os.IBinder;
  6. /**
  7. * @author whw
  8. * @time 2019/4/17
  9. * @Description 下载服务
  10. */
  11. public class DownServer extends Service {
  12. static final String TAG = "DownServer";
  13. Context context = this;
  14. private final DownPresenter mDownPresenter;
  15. public DownServer() {
  16. mDownPresenter = DownPresenter.getInstance();
  17. }
  18. @Override
  19. public IBinder onBind(Intent intent) {
  20. return null;
  21. }
  22. @Override
  23. public int onStartCommand(Intent intent, int flags, int startId) {
  24. mDownPresenter.onStartCommand(intent, flags, startId);
  25. return super.onStartCommand(intent, flags, startId);
  26. }
  27. @Override
  28. public void onDestroy() {
  29. mDownPresenter.remove();
  30. super.onDestroy();
  31. }
  32. }