Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 846 Bytes

README.md

File metadata and controls

39 lines (29 loc) · 846 Bytes

ShotWatch

Android Screenshot Watcher (Screenshot Detection) using ContentObserver

ShotWatch

##Usage

ShotWatch mShotWatch;


void onCreate() {
	Listener listener = new Listener() {
		public void onScreenShotTaken(ScreenShotData data) {
			textView.setText(data.getFileName());
			imageView.setImageURI(URI.parse(data.getPath());
		}
	}
	
	mShotWatch = new ShotWatch(getContentResolver(), listener);
}

// Register to begin receive event
void onResume() {
	mShotWatch.register();
}

// Don't forget to unregister when apps goes to background
void onPause() {
	mShotWatch.unregister();
}

##Permission android.permission.READ_EXTERNAL_STORAGE

In Android M, you need to handle runtime permission.

Gradle

compile 'com.abangfadli.shotwatch:shotwatch:1.0.4'