Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.rodolfoizidoro:camerakit-android:1.0.1'
}
dependencies {
implementation("com.github.rodolfoizidoro:camerakit-android:1.0.1")
}
<dependency>
<groupId>com.github.rodolfoizidoro</groupId>
<artifactId>camerakit-android</artifactId>
<version>1.0.1</version>
</dependency>
libraryDependencies += "com.github.rodolfoizidoro" % "camerakit-android" % "1.0.1"
:dependencies [[com.github.rodolfoizidoro/camerakit-android "1.0.1"]]
CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service that scales, and endless camera possibilities.
With CameraKit you are able to effortlessly do the following:
CameraView
of any size (not just presets!).CameraView
bounds.METHOD_STANDARD
: an image captured normally using the camera APIs.METHOD_STILL
: a freeze frame of the CameraView
preview (similar to SnapChat and Instagram) for devices with slower cameras.METHOD_SPEED
: automatic capture method determination based on measured speed.<a href="https://www.expensify.com/"><img alt="Expensify" src=".repo/gh-readme-expensify-logo.svg" height="45px" width="375px" align="center"></a> <a href="https://www.buddy.works/"><img alt="Buddy.Works" src=".repo/gh-readme-buddyworks-logo.png" height="100px" width="250px" align="center"></a>
<a href="https://www.infitting.com/"><img alt="InFitting" src=".repo/gh-readme-infitting-logo.svg" height="30px" width="110px" align="center"></a> <a href="https://www.goosechase.com/"><img alt="GooseChase" src=".repo/gh-readme-goosechase-logo.svg" height="30px" width="175px" align="center"></a> <a href="https://www.alpha-apps.ae/"><img alt="Alpha Apps" src=".repo/gh-readme-alphaapps-logo.png" height="30px" width="78px" align="center"></a> <a href="https://www.expensify.com/"><img alt="Expensify" src=".repo/gh-readme-expensify-logo.svg" height="26px" width="220px" align="center"></a>
CameraKit has been going through major changes in the past few months. We've slowed support on verison 0.13.x
and moved our focus to 1.0.0
. This release will bring improved stability, faster processing and a standard API for future development of CameraKit. The lastest version is currently in beta, 1.0.0-beta3.10
.
The code lives on the branch v1.0.0
. You can read the discussion about 1.0.0
on the pull request #318. If you have a question or want to talk directly with the team, leave us a message on spectrum.chat.
Setup instructions for 1.0.0-beta3.10
are below. To see the full documentation head over to our website, camerakit.io/docs.
To include CameraKit in your project, add the following to your app
level build.gradle
.
dependencies {
implementation 'com.camerakit:camerakit:1.0.0-beta3.10'
implementation 'com.camerakit:jpegkit:0.1.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
}
Create a CameraKitView
in your layout as follows:
<com.camerakit.CameraKitView
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:keepScreenOn="true" <!-- keep screen awake while CameraKitView is active -->
app:camera_flash="auto"
app:camera_facing="back"
app:camera_focus="continuous"
app:camera_permissions="camera" />
Then create a new CameraKitView
object in your Activity
and override the following methods.
private CameraKitView cameraKitView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cameraKitView = findViewById(R.id.camera);
}
@Override
protected void onStart() {
super.onStart();
cameraKitView.onStart();
}
@Override
protected void onResume() {
super.onResume();
cameraKitView.onResume();
}
@Override
protected void onPause() {
cameraKitView.onPause();
super.onPause();
}
@Override
protected void onStop() {
cameraKitView.onStop();
super.onStop();
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
cameraKitView.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
If using ProGuard, add the following rules:
-dontwarn com.google.android.gms.**
-keepclasseswithmembers class com.camerakit.preview.CameraSurfaceView {
native <methods>;
}
CameraKit is MIT License