-1

i want to create a class in Android Studio using Kotlin that runs Camera in background

class MyForegroundService : Service() {

 override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
  val notification = createNotification()
  startForeground(1, notification)
  // **************** I want to add camerax here *****************************
  return START_STICKY
 }
}

to run the camera in background can you help me please

ahmad yamani
  • 3
  • 1
  • 2
  • I dont think android allows using the camera in the background – Torge Rosendahl Jan 07 '23 at 23:17
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jan 08 '23 at 03:31
  • class MyForegroundService : Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { val notification = createNotification() startForeground(1, notification) // **************** I want to add camerax here ***************************** return START_STICKY } } – ahmad yamani Jan 08 '23 at 08:33

1 Answers1

0

Do you want to develop any ForegroundService for android?

Some answers already have been made on the Use of camera as ForegroundService. You can check the links below.

Camera frames in a service / background process

Grafika, a dumping ground for Android graphics & media hacks.