title: ReCaptcha V2 response error 12008 in Android
body: <p>Below is my implementation of ReCaptcha V2 in my Android app.
  When I run it, it returns: <code>Error message: unknown status code: 12008</code></p>
  <p>This means the following:</p>
  <blockquote>
  <p>public static final int RECAPTCHA_INVALID_KEYTYPE Cannot start the
  reCAPTCHA service because type of site key is not valid.</p>
  <p>Please register new site key with the key type set to &quot;reCAPTCHA
  Android&quot; via //g.co/recaptcha/androidsignup.</p>
  <p>Constant Value: 12008</p>
  </blockquote>
  <p>My site key is available on my ReCaptcha admin portal, so what do I need to do for it to be 'valid'?</p>
  <p>The code example that I've implemented does include the following comments regarding the server url:</p>
  <pre><code>//it is google recaptcha siteverify server
  //you can place your server url
  </code></pre>
  <p>Is this a requirement or a suggestion?</p>
  <pre><code>public void onCaptchaClick(View view) {
      SafetyNet.getClient(this).verifyWithRecaptcha(SITE_KEY)
              .addOnSuccessListener(this, new OnSuccessListener&lt;SafetyNetApi.RecaptchaTokenResponse&gt;() {
                  @Override
                  public void onSuccess(SafetyNetApi.RecaptchaTokenResponse response) {
                      if (!response.getTokenResult().isEmpty()) {
                          handleSiteVerify(response.getTokenResult());
                      }
                  }
              })
              .addOnFailureListener(this, new OnFailureListener() {
                  @Override
                  public void onFailure(@NonNull Exception e) {
                      if (e instanceof ApiException) {
                          ApiException apiException = (ApiException) e;
                          Log.d(TAG, &quot;Error message: &quot; +
                                  CommonStatusCodes.getStatusCodeString(apiException.getStatusCode()));
                      } else {
                          Log.d(TAG, &quot;Unknown type of error: &quot; + e.getMessage());
                      }
                  }
              });
  
  }
  
  
  protected  void handleSiteVerify(final String responseToken){
      //it is google recaptcha siteverify server
      //you can place your server url
      String url = &quot;https://www.google.com/recaptcha/api/siteverify&quot;;
      StringRequest request = new StringRequest(Request.Method.POST, url,
              new Response.Listener&lt;String&gt;() {
                  @Override
                  public void onResponse(String response) {
                      try {
                          JSONObject jsonObject = new JSONObject(response);
                          if(jsonObject.getBoolean(&quot;success&quot;)){
                              Toast.makeText(getApplicationContext(),String.valueOf(jsonObject.getBoolean(&quot;success&quot;)),Toast.LENGTH_LONG).show();
                          }
                          else{
                              Toast.makeText(getApplicationContext(),String.valueOf(jsonObject.getString(&quot;error-codes&quot;)),Toast.LENGTH_LONG).show();
                          }
                      } catch (Exception ex) {
                          Log.d(TAG, &quot;JSON exception: &quot; + ex.getMessage());
  
                      }
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      Log.d(TAG, &quot;Error message: &quot; + error.getMessage());
                  }
              }) {
          @Override
          protected Map&lt;String, String&gt; getParams() {
              Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
              params.put(&quot;secret&quot;, SECRET_KEY);
              params.put(&quot;response&quot;, responseToken);
              return params;
          }
      };
      request.setRetryPolicy(new DefaultRetryPolicy(
              50000,
              DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
              DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
      queue.add(request);
  }
  </code></pre>