导航菜单

页面标题

页面副标题

新暖心缘 v8.1.1 - WakeupService.java 源代码

正在查看: 新暖心缘 v8.1.1 应用的 WakeupService.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.luanxingyuan.app.socket;

import android.annotation.TargetApi;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import com.luanxingyuan.app.util.LogUtil;

@TargetApi(21)
public class WakeupService extends JobService {
    private Handler handler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message message) {
            WakeupService.this.jobFinished((JobParameters) message.obj, true);
            Intent intent = new Intent(WakeupService.this.getApplicationContext(), (Class<?>) ConnectService.class);
            LogUtil.i("--------------一次job");
            if (Build.VERSION.SDK_INT >= 26) {
                WakeupService.this.startForegroundService(intent);
            } else {
                WakeupService.this.startService(intent);
            }
            return true;
        }
    });

    @Override
    public int onStartCommand(Intent intent, int i8, int i9) {
        return 1;
    }

    @Override
    public boolean onStartJob(JobParameters jobParameters) {
        Message obtain = Message.obtain();
        obtain.obj = jobParameters;
        this.handler.sendMessage(obtain);
        return true;
    }

    @Override
    public boolean onStopJob(JobParameters jobParameters) {
        this.handler.removeCallbacksAndMessages(null);
        return false;
    }
}