# FadCam App Shortcut and MacroDroid Integration: Code Examples and Implementation Guide

> Integrate FadCam with MacroDroid using code examples. Control recording, torch, and camera via public Intents for seamless automation. Unlock FadCam's full potential now.

- Repository: [Faded/FadCam](https://github.com/anonfaded/FadCam)
- Tags: how-to-guide
- Published: 2026-05-13

---

**FadCam exposes camera controls via public Intent actions defined in [`RecordingControlIntents.java`](https://github.com/anonfaded/FadCam/blob/main/RecordingControlIntents.java), enabling MacroDroid to trigger recording, toggle torch, and switch cameras by broadcasting specific action strings to the `com.fadcam` package.**

The open-source Android application FadCam (anonfaded/FadCam) provides programmatic access to its recording features through a robust shortcut system. By leveraging the `ShortcutManager` API and documented broadcast intents, users can integrate FadCam with automation tools like MacroDroid without root access. This guide provides the complete source code references and practical examples needed to implement FadCam app shortcut and MacroDroid integration.

## Available Shortcut Actions and Intent Constants

FadCam defines eight distinct actions in [`app/src/main/java/com/fadcam/RecordingControlIntents.java`](https://github.com/anonfaded/FadCam/blob/main/app/src/main/java/com/fadcam/RecordingControlIntents.java) that control recording, photography, and hardware features. These constants are public and stable, making them safe for external automation.

### Core Recording Actions

- **ACTION_START_BACK** (`com.fadcam.ACTION_START_BACK`): Initiates video recording using the rear camera
- **ACTION_START_FRONT** (`com.fadcam.ACTION_START_FRONT`): Initiates video recording using the front camera  
- **ACTION_START_CURRENT** (`com.fadcam.ACTION_START_CURRENT`): Starts recording with the currently selected camera mode
- **ACTION_STOP_RECORDING** (`com.fadcam.ACTION_STOP_RECORDING`): Stops any active recording session

### Camera and Flash Controls

- **ACTION_TOGGLE_TORCH** (`com.fadcam.ACTION_TOGGLE_TORCH`): Toggles the flashlight on or off during recording
- **ACTION_TAKE_PHOTO** (`com.fadcam.ACTION_TAKE_PHOTO`): Captures a still image with the rear camera
- **ACTION_TAKE_PHOTO_FRONT** (`com.fadcam.ACTION_TAKE_PHOTO_FRONT`): Captures a still image with the front camera
- **ACTION_TAKE_SCREENSHOT** (`com.fadcam.ACTION_TAKE_SCREENSHOT`): Saves a screenshot of the current view

## Source Code Architecture

Understanding how FadCam wires these intents helps troubleshoot integration issues and ensures your MacroDroid macros use the correct target components.

### Intent Definitions in RecordingControlIntents.java

The `RecordingControlIntents` class serves as the public API contract. As implemented in [`app/src/main/java/com/fadcam/RecordingControlIntents.java`](https://github.com/anonfaded/FadCam/blob/main/app/src/main/java/com/fadcam/RecordingControlIntents.java), the actions are defined as standard Java constants:

```java
public final class RecordingControlIntents {
    public static final String ACTION_START_BACK      = "com.fadcam.ACTION_START_BACK";
    public static final String ACTION_START_FRONT     = "com.fadcam.ACTION_START_FRONT";
    public static final String ACTION_STOP_RECORDING  = "com.fadcam.ACTION_STOP_RECORDING";
    public static final String ACTION_TOGGLE_TORCH    = "com.fadcam.ACTION_TOGGLE_TORCH";
    public static final String ACTION_TAKE_PHOTO      = "com.fadcam.ACTION_TAKE_PHOTO";
    public static final String ACTION_TAKE_PHOTO_FRONT = "com.fadcam.ACTION_TAKE_PHOTO_FRONT";
    public static final String ACTION_TAKE_SCREENSHOT = "com.fadcam.ACTION_TAKE_SCREENSHOT";
}

```

### Shortcut Manifest Declaration

The static shortcuts visible in the Android launcher are declared in [`app/src/main/res/xml/shortcuts.xml`](https://github.com/anonfaded/FadCam/blob/main/app/src/main/res/xml/shortcuts.xml). Each entry maps to one of the above actions, allowing users to add icons to their home screen without writing code.

### Broadcast Receiver Implementation

FadCam registers `RecordingControlReceiver` in the AndroidManifest.xml to handle external intents. This receiver listens for the action strings defined in `RecordingControlIntents` and delegates to the appropriate internal methods (`startRecording()`, `stopRecording()`, `toggleTorch()`). The pinning logic for dynamic shortcuts lives in [`app/src/main/java/com/fadcam/receivers/ShortcutPinResultReceiver.java`](https://github.com/anonfaded/FadCam/blob/main/app/src/main/java/com/fadcam/receivers/ShortcutPinResultReceiver.java), which handles the system callback when users add shortcuts via the "Add to Home" dialog.

## MacroDroid Integration Setup

MacroDroid can trigger FadCam actions by sending broadcast intents with the specific action strings. No root access is required because FadCam exports these receivers publicly.

### Configuring a Toggle Torch Macro

To create a MacroDroid macro that toggles the flashlight using the volume-up button:

1. **Create a new macro** and set the trigger to *Volume Button Pressed* → select *Volume Up*
2. **Add an Action** → select *Launch App*
3. **Configure the Intent**:
   - *Package*: `com.fadcam`
   - *Class*: `com.fadcam.receivers.RecordingControlReceiver`
   - *Action*: `com.fadcam.ACTION_TOGGLE_TORCH`
4. **Save and enable** the macro

Pressing volume-up will now immediately toggle the torch state in FadCam.

### Starting Recording via Intent

To start a back-camera recording from MacroDroid, use the same configuration but replace the action string with `com.fadcam.ACTION_START_BACK`. For front-camera recording, use `com.fadcam.ACTION_START_FRONT`. To stop recording programmatically, use `com.fadcam.ACTION_STOP_RECORDING`.

## Developer Code Examples

For developers building custom launchers or automation plugins, FadCam's shortcut system supports both programmatic pinning and direct intent broadcasting.

### Programmatically Pinning a Shortcut

The following Kotlin snippet demonstrates how to request the system to pin the "Toggle Torch" shortcut, using the same pattern found in `ShortcutPinResultReceiver`:

```kotlin
import androidx.core.content.pm.ShortcutInfoCompat
import androidx.core.content.pm.ShortcutManagerCompat
import androidx.core.graphics.drawable.IconCompat

val shortcutInfo = ShortcutInfoCompat.Builder(context, "torch_shortcut")
    .setShortLabel("Toggle Torch")
    .setLongLabel("Toggle Flashlight")
    .setIcon(IconCompat.createWithResource(context, R.drawable.flashlight_shortcut))
    .setIntent(
        Intent("com.fadcam.ACTION_TOGGLE_TORCH").apply {
            setPackage("com.fadcam")
        }
    )
    .build()

if (ShortcutManagerCompat.isRequestPinShortcutSupported(context)) {
    ShortcutManagerCompat.requestPinShortcut(context, shortcutInfo, null)
}

```

### Sending Intents from External Apps

Any Android app can trigger FadCam recording by sending an explicit intent:

```java
Intent intent = new Intent();
intent.setAction("com.fadcam.ACTION_START_BACK");
intent.setPackage("com.fadcam");
context.sendBroadcast(intent);

```

For activities rather than broadcasts, use `context.startActivity(intent)` with the same action string.

### MacroDroid Macro Export Format

Below is the JSON representation of a MacroDroid macro that binds volume-up to the torch toggle. Import this via MacroDroid's backup/restore feature:

```json
{
  "name": "FadCam Toggle Torch",
  "trigger": { 
    "type": "volume_key", 
    "key": "volume_up" 
  },
  "actions": [
    {
      "type": "launch_app",
      "package_name": "com.fadcam",
      "class_name": "com.fadcam.receivers.RecordingControlReceiver",
      "intent_action": "com.fadcam.ACTION_TOGGLE_TORCH"
    }
  ]
}

```

## Summary

- **FadCam exposes eight public Intent actions** in [`RecordingControlIntents.java`](https://github.com/anonfaded/FadCam/blob/main/RecordingControlIntents.java) that control recording, photography, and torch functionality
- **MacroDroid integration requires no root access**; simply send broadcasts to `com.fadcam.receivers.RecordingControlReceiver` with the appropriate action string
- **Static shortcuts** are defined in [`app/src/main/res/xml/shortcuts.xml`](https://github.com/anonfaded/FadCam/blob/main/app/src/main/res/xml/shortcuts.xml) and can be pinned to the home screen
- **Dynamic shortcut pinning** is handled by [`ShortcutPinResultReceiver.java`](https://github.com/anonfaded/FadCam/blob/main/ShortcutPinResultReceiver.java) using the AndroidX `ShortcutManagerCompat` API
- **All action strings follow the pattern** `com.fadcam.ACTION_*` and are stable for third-party automation

## Frequently Asked Questions

### What Intent action starts recording with the back camera?

Use the string `com.fadcam.ACTION_START_BACK` defined in [`RecordingControlIntents.java`](https://github.com/anonfaded/FadCam/blob/main/RecordingControlIntents.java). Send this as a broadcast intent to the `com.fadcam` package with `RecordingControlReceiver` as the target class.

### Can MacroDroid stop an ongoing FadCam recording?

Yes. Send a broadcast intent with the action `com.fadcam.ACTION_STOP_RECORDING` to the `RecordingControlReceiver`. This immediately stops the active recording session and saves the file to the configured storage location.

### Where are the shortcut icons defined in the FadCam source code?

The shortcut metadata and icon references are located in [`app/src/main/res/xml/shortcuts.xml`](https://github.com/anonfaded/FadCam/blob/main/app/src/main/res/xml/shortcuts.xml). The actual drawable resources (such as `@drawable/flashlight_shortcut` and `@drawable/start_back_shortcut`) are stored in the corresponding `res/drawable*` directories.

### Is root access required for MacroDroid to control FadCam?

No root access is necessary. FadCam exports its `RecordingControlReceiver` publicly in the AndroidManifest.xml, allowing any app with the `android.permission.BROADCAST_STICKY` or standard broadcast permissions to send commands to these Intent actions.