Skip to content

mr-stan-dev/snaply-flutter-plugin

Repository files navigation

Snaply

⚠️ This plugin is in alpha stage and its API may change. ⚠️

A Flutter plugin that enables instant bug reports sharing with screenshots, screen recordings, attributes, and logs.

Designed for developers and QA engineers to enhance debugging and testing processes.

License: Apache-2.0

Features

  • 📸 Screenshots capturing
  • 🎥 Screen recording
  • 📱 Device & System information collection
  • 📝 Custom attributes support
  • 📊 Event logging
  • 📁 Share all data as an archive or individual files

Demo

Snaply.Demo.Video.mp4

Quick Start

  1. Add to your pubspec.yaml:
dependencies:
  snaply: ^0.0.1-alpha.6  
  1. Wrap your App with SnaplyApp:
void main() {
  const myApp = MyApp();
  // Enable Snaply based on your build configuration
  const isSnaplyEnabled = true;
  if (isSnaplyEnabled) {
    runApp(
      const SnaplyApp(
        isVisible: true,
        child: exampleApp,
      ),
    );
  } else {
    runApp(myApp);
  }
}

How to

Control Visibility

To show or hide report button in runtime, use:

SnaplyReporter.instance.setVisibility(isVisible: false);

Add Custom Attributes

While Snaply automatically collects device & system attributes, you can add custom attributes:

SnaplyReporter.instance.setAttributes(
  attrKey: 'app_info',
  attrMap: {
    'version': '0.0.1',
  },
);

Add Logs

Snaply includes basic internal logs by default. To capture additional logs, add this to your app's logger:

SnaplyReporter.instance.log(message: 'Onboarding finished'); 

Register Callbacks

You can register onReportReview callback to execute custom logic right before review report. E.G. you can set most up to date attributes or custom files:

SnaplyReporter.instance.registerCallbacks(
  onReportReview: () async {
    SnaplyReporter.instance.setAttributes(
      attrKey: 'app_info',
      attrMap: {
        'version': '0.0.1',
      },
    );
  },
);

Platform Specifics

Android Screen Recording

Frame Sequence Mode (Default):

This mode creates an MP4 video from captured frames. No additional permissions are required, but there are some limitations:

  1. Only captures Flutter App UI (system UI elements & native views are not included)
  2. May show minor UI glitches
  3. Provides acceptable but not optimal quality

Media Projection Mode:

Enable this mode by setting:

--dart-define=SNAPLY_CONFIG=useAndroidMediaProjection

This mode uses Android MediaProjection API. Snaply will add required permissions to AndroidManifest.xml automatically. With this mode you'll have:

  1. Complete screen capture including system UI and native views
  2. Higher video quality

Permissions to be added by Snaply if you set useAndroidMediaProjection flag:

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />  
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />   

Best Practice: Use media projection mode only for development/testing builds, not for Google Play releases, unless these permissions are already part of your app.

⚠️ WARNING! ⚠️ If you send a build with useAndroidMediaProjection flag to GooglePlay - it might not pass App review and Google will ask to explain why you need screen recording permissions.

iOS Screen Recording

Uses ReplayKit to capture the Flutter App UI only. Like Android, system UI & native views are not included.

Note: The useAndroidMediaProjection flag has no effect on iOS

Android Screenshots

Currently limited to Flutter App UI capture only (system UI elements & native views are not included)

iOS Screenshots

Uses UIKit for screenshots, capturing only Flutter App UI (system UI elements & native views are not included)

Requirements

  • Flutter: >=3.0.0
  • iOS: 11.0 or newer
  • Android: API Level 23 or newer

Additional information

License

Apache License 2.0 - see LICENSE for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published