Hello dear android developers. In this article, I will be giving you information about Android reCAPTCHA Usage.. First of all, let’s take a look at what reCAPTCHA is;
What is reCAPTCHA?
“reCAPTCHA is an application that provides human effort to scan and digitize articles that are difficult to be automatically recognized for the security of web pages. ”
In short, by using reCAPTCHA, we use it before the transactions that we want to slow down the member form filling processes, signing up, logging in and similar easy filling processes, and want to be sure of their accuracy for security.
Using Android reCAPTCHA
- First, let’s open the reCAPTCHA site and create a new project.
- Then let’s get the key generated for us.
- Then let’s open android studio.
- Let’s create a new project in kotlin/java.
- /build.gradle content as follows and synchronize it with the ‘sync now’ button. dependencies { implementation fileTree(dir: ‘libs’, include: [‘*.jar’]) implementation”org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version” implementation ‘androidx.appcompat:appcompat:1.1.0’ implementation ‘androidx.core:core-ktx:1.1.0’ implementation ‘androidx.constraintlayout:constraintlayout:1.1.3’ //recaptcha implementation ‘com.google.android.gms:play-services-safetynet:17.0.0’ }
- Let’s add our site key to MainActivity.kt. private val siteKey: String = “6Le72ccUAAAAADRmRU5_DAMJRh0JB4Uuz3L8Q_lz”
- Now let’s just add security verification with a very short code. SafetyNet.getClient(this).verifyWithRecaptcha(siteKey) .addOnSuccessListener { //Works if successful Toast.makeText(this, “Success”, Toast.LENGTH_LONG).show() }.addOnFailureListener { //If received an error Toast.makeText(this) , “Error”, Toast.LENGTH_LONG).show() }
- After connecting as client, we add our key as parameter. The rest is to guide the user, waiting for success or failure.
Let’s change the
In this article we have included using android reCAPTCHA. You can access the project codes here. Please do not forget to comment for your questions, comments and suggestions.