# RxScreenshotDetector **Repository Path**: HarmonyOS-tpc/RxScreenshotDetector ## Basic Information - **Project Name**: RxScreenshotDetector - **Description**: openharmony screenshot detector with DataAbilityHelper and Rx. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 0 - **Created**: 2021-04-15 - **Last Updated**: 2023-04-17 ## Categories & Tags **Categories**: harmonyos-toolkit **Tags**: None ## README ## RxScreenshotDetector ## Introduction openharmony screenshot detector with DataAbilityHelper and Rx. ### Screenshots ### Features - Starting the screenshot detector using Rx implementation methods. - Subscribing the `Observable` for listening event when a screenshot is taken. ## Usage instructions Add the `RxScreenshotDetector` and register the subscription in code: ```java RxScreenshotDetector.start(this) .subscribeOn(Schedulers.io()) .observeOn(OpenHarmonySchedulers.mainThread()) .subscribe(path -> mTextView.setText(mTextView.getText() + "\nScreenshot: " + path), Throwable::printStackTrace); ``` ## Installation instruction Method 1: Generate the .har package through the library and add the .har package to the libs folder. Add the following code to the entry gradle: ``` implementation fileTree (dir: 'libs', include: ['*.jar', '*.har']) api 'io.reactivex.rxjava3:rxjava:3.0.3' implementation 'io.openharmony.tpc.thirdlib:Rxohos:1.0.0' ``` Method 2: In project level build.gradle: ``` allprojects{ repositories{ mavenCentral() } } ``` Add the following code to the entry gradle: ``` api 'io.reactivex.rxjava3:rxjava:3.0.3' implementation 'io.openharmony.tpc.thirdlib:Rxohos:1.0.0' implementation 'io.openharmony.tpc.thirdlib:RxScreenshotDetector:1.0.1' ```