lightbulb_outline Help shape the future of the Google Play Console, Android Studio, and Firebase. Start survey

CameraPrewarmService

public abstract class CameraPrewarmService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.service.media.CameraPrewarmService


Extend this class to implement a camera prewarm service. See MediaStore.META_DATA_STILL_IMAGE_CAMERA_PREWARM_SERVICE.

Summary

Inherited constants

Public constructors

CameraPrewarmService()

Public methods

IBinder onBind(Intent intent)

Return the communication channel to the service.

abstract void onCooldown(boolean cameraIntentFired)

Called when prewarm phase is done, either because the camera launch intent has been fired at this point or prewarm is no longer needed.

abstract void onPrewarm()

Called when the camera should be prewarmed.

boolean onUnbind(Intent intent)

Called when all clients have disconnected from a particular interface published by the service.

Inherited methods

Public constructors

CameraPrewarmService

added in API level 23
public CameraPrewarmService ()

Public methods

onBind

added in API level 23
public IBinder onBind (Intent intent)

Return the communication channel to the service. May return null if clients can not bind to the service. The returned IBinder is usually for a complex interface that has been described using aidl.

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.

Parameters
intent Intent: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.

Returns
IBinder Return an IBinder through which clients can call on to the service.

onCooldown

added in API level 23
public abstract void onCooldown (boolean cameraIntentFired)

Called when prewarm phase is done, either because the camera launch intent has been fired at this point or prewarm is no longer needed. A client should close the camera immediately in the latter case.

In case the camera launch intent has been fired, there is no guarantee about the ordering of these two events. Cooldown might happen either before or after the activity has been created that handles the camera intent.

Parameters
cameraIntentFired boolean: Indicates whether the intent to launch the camera has been fired.

onPrewarm

added in API level 23
public abstract void onPrewarm ()

Called when the camera should be prewarmed.

onUnbind

added in API level 23
public boolean onUnbind (Intent intent)

Called when all clients have disconnected from a particular interface published by the service. The default implementation does nothing and returns false.

Parameters
intent Intent: The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.

Returns
boolean Return true if you would like to have the service's onRebind(Intent) method later called when new clients bind to it.