|
|
|
|
|
|
|
|
package com.example.ueberwachungssystem.Detection; |
|
|
package com.example.ueberwachungssystem.Detection; |
|
|
|
|
|
|
|
|
import android.Manifest; |
|
|
|
|
|
import android.app.Activity; |
|
|
|
|
|
import android.content.Intent; |
|
|
import android.content.Intent; |
|
|
import android.content.pm.PackageManager; |
|
|
|
|
|
import android.os.Binder; |
|
|
import android.os.Binder; |
|
|
import android.os.IBinder; |
|
|
import android.os.IBinder; |
|
|
import android.util.Log; |
|
|
|
|
|
import android.widget.ImageView; |
|
|
import android.widget.ImageView; |
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.camera.core.ExperimentalGetImage; |
|
|
import androidx.camera.core.ExperimentalGetImage; |
|
|
import androidx.core.app.ActivityCompat; |
|
|
|
|
|
import androidx.core.content.ContextCompat; |
|
|
|
|
|
import androidx.lifecycle.LifecycleService; |
|
|
import androidx.lifecycle.LifecycleService; |
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
import java.io.File; |
|
|
|
|
|
|
|
|
@ExperimentalGetImage |
|
|
@ExperimentalGetImage |
|
|
public class DetectorService extends LifecycleService { |
|
|
public class DetectorService extends LifecycleService { |
|
|
|
|
|
|
|
|
public TestBinder testBinder = new TestBinder(); |
|
|
|
|
|
|
|
|
public ServiceBinder serviceBinder = new ServiceBinder(); |
|
|
private DetectorService.OnDetectionListener listener; |
|
|
private DetectorService.OnDetectionListener listener; |
|
|
private boolean isServiceRunning = false; |
|
|
private boolean isServiceRunning = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** Service methods */ |
|
|
/** Service methods */ |
|
|
public class TestBinder extends Binder { |
|
|
|
|
|
|
|
|
public class ServiceBinder extends Binder { |
|
|
public DetectorService getBoundService() { |
|
|
public DetectorService getBoundService() { |
|
|
// Return an instance of the TestService |
|
|
// Return an instance of the TestService |
|
|
return DetectorService.this; |
|
|
return DetectorService.this; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public IBinder onBind(Intent intent) { |
|
|
public IBinder onBind(Intent intent) { |
|
|
super.onBind(intent); |
|
|
super.onBind(intent); |
|
|
return testBinder; |
|
|
|
|
|
|
|
|
return serviceBinder; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|