This library using openForResult
or start Camera App without callback.
Support Android N(FileUriExposedException).
To use this library your minSdkVersion
must be >= 16. just because of not to be old school developer!
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency:
dependencies {
implementation 'com.github.1van:RxIntent:-SNAPSHOT'
}
RxIntent.open(ExampleActivity.this, ResultActivity.class)
.subscribe(result -> {
// TODO
});
RxIntent.with(this)
.intent(new Intent(ExampleActivity.this, ResultActivity.class))
.open()
.subscribe(result -> {
// TODO
});
Capture videos:
RxIntent.with(this)
.video()
.setDurationLimit(10)
.setVideoQuality(1)
.file() // Provide two return types are File and Uri.
.subscribe(file -> {
// TODO
});
Capture images:
RxIntent.with(this)
.image()
.uri() // Provide two return types are File and Uri.
.subscribe(uri -> {
// TODO
});
With RxPermissions:
RxPermissions rxPermissions = new RxPermissions(this);
rxPermissions.request(Manifest.permission.CAMERA,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
.flatMap(granted -> RxIntent.with(this).image().uri())
.subscribe(uri -> {
// TODO
});