diff --git a/docs/docs/guides/FRAME_PROCESSOR_CREATE_PLUGIN_ANDROID.mdx b/docs/docs/guides/FRAME_PROCESSOR_CREATE_PLUGIN_ANDROID.mdx index ed9141f..e853de2 100644 --- a/docs/docs/guides/FRAME_PROCESSOR_CREATE_PLUGIN_ANDROID.mdx +++ b/docs/docs/guides/FRAME_PROCESSOR_CREATE_PLUGIN_ANDROID.mdx @@ -88,7 +88,7 @@ import com.mrousavy.camera.frameprocessor.FrameProcessorPluginRegistry; public class FaceDetectorFrameProcessorPluginPackage implements ReactPackage { // highlight-start - FaceDetectorFrameProcessorPluginPackage() { + static { FrameProcessorPluginRegistry.addFrameProcessorPlugin("detectFaces", options -> new FaceDetectorFrameProcessorPlugin(options)); } // highlight-end @@ -158,9 +158,11 @@ import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin class FaceDetectorFrameProcessorPluginPackage : ReactPackage { // highlight-start - init { - FrameProcessorPluginRegistry.addFrameProcessorPlugin("detectFaces") { options -> - FaceDetectorFrameProcessorPlugin(options) + companion object { + init { + FrameProcessorPluginRegistry.addFrameProcessorPlugin("detectFaces") { options -> + FaceDetectorFrameProcessorPlugin(options) + } } } // highlight-end diff --git a/package/example/android/app/src/main/java/com/mrousavy/camera/example/MainApplication.java b/package/example/android/app/src/main/java/com/mrousavy/camera/example/MainApplication.java index ba52164..8037fa9 100644 --- a/package/example/android/app/src/main/java/com/mrousavy/camera/example/MainApplication.java +++ b/package/example/android/app/src/main/java/com/mrousavy/camera/example/MainApplication.java @@ -18,6 +18,11 @@ import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin; import com.mrousavy.camera.frameprocessor.FrameProcessorPluginRegistry; public class MainApplication extends Application implements ReactApplication { + // Register the Frame Processor Plugins for our app + static { + FrameProcessorPluginRegistry.addFrameProcessorPlugin("example_plugin", options -> new ExampleFrameProcessorPlugin(options)); + FrameProcessorPluginRegistry.addFrameProcessorPlugin("example_kotlin_swift_plugin", options -> new ExampleKotlinFrameProcessorPlugin(options)); + } private final ReactNativeHost mReactNativeHost = new DefaultReactNativeHost(this) { @@ -64,8 +69,5 @@ public class MainApplication extends Application implements ReactApplication { // If you opted-in for the New Architecture, we load the native entry point for this app. DefaultNewArchitectureEntryPoint.load(); } - - FrameProcessorPluginRegistry.addFrameProcessorPlugin("example_plugin", options -> new ExampleFrameProcessorPlugin(options)); - FrameProcessorPluginRegistry.addFrameProcessorPlugin("example_kotlin_swift_plugin", options -> new ExampleKotlinFrameProcessorPlugin(options)); } }