RxScreenshotDetector
RxScreenshotDetector copied to clipboard
Android screenshot detector with ContentObserver and Rx.
RxScreenshotDetector
Android screenshot detector with ContentObserver and Rx.
Note that this library only work as best effort, it won't (and can't I think) cover all corner cases. Good luck with it :)
ScreenShot
Usage
Add to gradle dependency of your module build.gradle:
repositories {
maven {
url "http://dl.bintray.com/piasy/maven"
}
}
dependencies {
compile 'com.github.piasy:rxscreenshotdetector:1.2.0'
}
Use in code:
RxScreenshotDetector.start(this)
.compose(bindToLifecycle())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(path -> mTextView.setText(mTextView.getText() + "\nScreenshot: " + path),
Throwable::printStackTrace);
To use with RxJava 1.x, see RxJava2Interop.
See full example for more details.
Acknowledgements
- Thanks for RxPermissions, for request permission in reactive way.