正在查看: 微商客 v2.1.2 应用的 ResponseService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 微商客 v2.1.2 应用的 ResponseService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.qiyukf.nimlib.service;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import com.qiyukf.nimlib.c;
import com.qiyukf.nimlib.d.g;
import com.qiyukf.nimlib.l.a.c;
import com.qiyukf.nimlib.l.e;
import com.qiyukf.nimlib.r.k;
import com.qiyukf.nimlib.r.x;
import com.qiyukf.nimlib.sdk.StatusBarNotificationConfig;
import com.qiyukf.nimlib.sdk.event.model.NimOnlineStateEvent;
public class ResponseService extends Service {
private boolean a;
@Override
public IBinder onBind(Intent intent) {
return null;
}
public static void a(Context context) {
if (context == null) {
com.qiyukf.nimlib.log.b.H("Push awake UI by Service failed, as context is null");
return;
}
if (!k.a(context, ResponseService.class)) {
com.qiyukf.nimlib.log.b.H("Push awake UI by Service failed, as AndroidManifest.xml has not configured");
}
Intent intent = new Intent(context, (Class<?>) ResponseService.class);
try {
if (x.a(context)) {
com.qiyukf.nimlib.log.b.H("android 12 can not startForegroundService in background");
} else if (x.b(context)) {
context.startForegroundService(intent);
} else {
context.startService(intent);
}
} catch (Throwable th) {
com.qiyukf.nimlib.log.b.H("Push awake UI Exception = ".concat(String.valueOf(th)));
}
}
@Override
public void onCreate() {
super.onCreate();
a();
}
private static int b(Context context) {
StatusBarNotificationConfig statusBarNotificationConfig = c.h().statusBarNotificationConfig;
if (statusBarNotificationConfig == null || statusBarNotificationConfig.notificationSmallIconId == 0) {
return context.getApplicationInfo().icon;
}
return statusBarNotificationConfig.notificationSmallIconId;
}
@Override
public int onStartCommand(Intent intent, int i, int i2) {
try {
a();
g.a().g();
} catch (Throwable unused) {
}
this.a = false;
return super.onStartCommand(intent, i, i2);
}
private void a() {
if (!x.b(this) || this.a) {
com.qiyukf.nimlib.log.b.c("ResponseService", String.format("callStartForeground %s %s", Boolean.valueOf(!x.b(this)), Boolean.valueOf(this.a)));
return;
}
com.qiyukf.nimlib.log.b.c("ResponseService", "callStartForeground");
try {
e.e(this);
startForeground(NimOnlineStateEvent.MODIFY_EVENT_CONFIG, new c.d(this, e.d(this)).a(b(this)).a());
com.qiyukf.nimlib.e.b.a.a(this).postDelayed(new Runnable() {
@Override
public final void run() {
ResponseService.this.stopForeground(true);
}
}, 1000L);
this.a = true;
} catch (Throwable th) {
th.printStackTrace();
com.qiyukf.nimlib.log.b.d("ResponseService", "callStartForeground", th);
}
}
}