|
@@ -60,22 +60,6 @@ public class ListenerShotService extends Service {
|
|
|
if (intent != null) {
|
|
if (intent != null) {
|
|
|
userId = intent.getStringExtra(EXTRA_KEY_USER_ID);
|
|
userId = intent.getStringExtra(EXTRA_KEY_USER_ID);
|
|
|
}
|
|
}
|
|
|
- if(runningTaskUtil == null) {
|
|
|
|
|
- //初始化获取当前应用的工具类
|
|
|
|
|
- runningTaskUtil = new RunningTaskUtil(getApplicationContext());
|
|
|
|
|
- }
|
|
|
|
|
- if(manager == null) {
|
|
|
|
|
- //开启监听
|
|
|
|
|
- manager = ScreenShotListenManager.newInstance(getApplicationContext());
|
|
|
|
|
- manager.setListener(
|
|
|
|
|
- new ScreenShotListenManager.OnScreenShotListener() {
|
|
|
|
|
- public void onShot(String imagePath) {
|
|
|
|
|
- addPng(imagePath);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- );
|
|
|
|
|
- manager.startListen();
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
Notification.Builder notificationBuilder = new Notification.Builder(getApplicationContext());
|
|
Notification.Builder notificationBuilder = new Notification.Builder(getApplicationContext());
|
|
|
//点击通知栏跳转到相应的应用里面
|
|
//点击通知栏跳转到相应的应用里面
|
|
@@ -98,6 +82,22 @@ public class ListenerShotService extends Service {
|
|
|
notification.flags |= Notification.FLAG_NO_CLEAR;
|
|
notification.flags |= Notification.FLAG_NO_CLEAR;
|
|
|
//这里的id不能是0
|
|
//这里的id不能是0
|
|
|
startForeground(113922, notification);
|
|
startForeground(113922, notification);
|
|
|
|
|
+ if(runningTaskUtil == null) {
|
|
|
|
|
+ //初始化获取当前应用的工具类
|
|
|
|
|
+ runningTaskUtil = new RunningTaskUtil(getApplicationContext());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(manager == null) {
|
|
|
|
|
+ //开启监听
|
|
|
|
|
+ manager = ScreenShotListenManager.newInstance(getApplicationContext());
|
|
|
|
|
+ manager.setListener(
|
|
|
|
|
+ new ScreenShotListenManager.OnScreenShotListener() {
|
|
|
|
|
+ public void onShot(String imagePath) {
|
|
|
|
|
+ addPng(imagePath);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+ manager.startListen();
|
|
|
|
|
+ }
|
|
|
return super.onStartCommand(intent, flags, startId);
|
|
return super.onStartCommand(intent, flags, startId);
|
|
|
}
|
|
}
|
|
|
private ScreenShotListenManager manager;
|
|
private ScreenShotListenManager manager;
|