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.tobiaskaminsky:qrcodescanner:0.1.2.4'
}
dependencies {
implementation("com.github.tobiaskaminsky:qrcodescanner:0.1.2.4")
}
<dependency>
<groupId>com.github.tobiaskaminsky</groupId>
<artifactId>qrcodescanner</artifactId>
<version>0.1.2.4</version>
</dependency>
libraryDependencies += "com.github.tobiaskaminsky" % "qrcodescanner" % "0.1.2.4"
:dependencies [[com.github.tobiaskaminsky/qrcodescanner "0.1.2.4"]]
QR Scanning library based on zxing for android devices API 15 and up
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.blikoon:QRCodeScanner:0.1.2'
}
Be sure to check the latest version here
private static final int REQUEST_CODE_QR_SCAN = 101;
@Override
public void onClick(View v) {
Intent i = new Intent(MainActivity.this,QrCodeActivity.class);
startActivityForResult( i,REQUEST_CODE_QR_SCAN);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode != Activity.RESULT_OK)
{
Log.d(LOGTAG,"COULD NOT GET A GOOD RESULT.");
if(data==null)
return;
//Getting the passed result
String result = data.getStringExtra("com.blikoon.qrcodescanner.error_decoding_image");
if( result!=null)
{
AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("Scan Error");
alertDialog.setMessage("QR Code could not be scanned");
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertDialog.show();
}
return;
}
if(requestCode == REQUEST_CODE_QR_SCAN)
{
if(data==null)
return;
//Getting the passed result
String result = data.getStringExtra("com.blikoon.qrcodescanner.got_qr_scan_relult");
Log.d(LOGTAG,"Have scan result in your app activity :"+ result);
AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("Scan result");
alertDialog.setMessage(result);
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertDialog.show();
}
}
https://github.com/blikoon/QRCodeScanner/tree/master/app
https://www.youtube.com/watch?v=R9JxDpKpkAk
GPLv3
Submit a github issue
If you need one of our Commercial Services then do Contact us otherwise shoot us in the comments section of This librarie's article.We won't respond to general usage questions posted as github issues.