Skip to content

Camera remote cameraremotelibrary

A connection library for Android to remote control DSLR / DSLM cameras, connected via USB.

1
implementation("de.stuermerbenjamin:cameraremote-free:<latest-version>")

Getting started

To get started, simply create an instance of CameraInterface with a CameraInterfaceListener as callback. Connect the communication with a supported usb device.

1
2
val cameraInterface = CameraInterface(applicationContext, cameraListener)
cameraInterface.connect(device)

Call disconnect() to end an active session at any time. If the device connection got interrupted, most cameras close sessions by themself.

Device information

Detailed device informations can be found int the DeviceInfo by calling its getter.

1
cameraInterface.getDeviceInfo()

Control

Use basic commands to remote control the camera.

1
2
cameraInterface.focus()
cameraInterface.triggerCapture()

The results of the capture will appear inside onCapturedPictureReceived on the CameraInterfaceListener and can be loaded via retrievePicture.

1
cameraInterface.retrievePicture()

USB Host Permissions

To work with USB Host permissions on Android, see the official documentation. Detect newly attached and detached devices, just add register regarding broadcast receivers.

1
2
3
4
5
6
7
registerReceiver(usbPermissionReceiver, IntentFilter(USB_PERMISSION))

val filterAttached = IntentFilter("android.hardware.usb.action.USB_DEVICE_ATTACHED")
registerReceiver(usbDeviceAttachedReceiver, filterAttached)

val filterDetached = IntentFilter("android.hardware.usb.action.USB_DEVICE_DETACHED")
registerReceiver(usbDeviceDettachedReceiver, filterDetached)