4

AndroidアプリのコードにCaptchaを実装する必要がありますが、その方法がわかりません。

誰かがここで私を助けてくれますか?

4

3 に答える 3

4

SimpleCaptchaまたはJCaptchaを見てください。

于 2012-05-14T18:40:41.497 に答える
3

恥知らずな自己宣伝ですが、私は他のすべての選択肢を嫌いでした。具体的には、それらはすべてネットワークベースであるということです。さて、私のものにはたくさんの作業などが必要であり、別の外部ソリューションを使用するほど安全ではないかもしれませんが、少なくとも使いやすく、いくつかのオプションがあります。

ここでGitして、変更とコミットを楽しんでください

于 2012-05-31T20:01:32.333 に答える
2

現在、GoogleはこのためのSafetyNetreCAPTCHAライブラリを提供しています。詳細については、こちら
をご覧ください。

以下は、reCaptchaを実装するための手順です。

  1. SafetyNetAPIの依存関係を追加する
dependencies {
    compile 'com.google.android.gms:play-services-safetynet:15.0.1'
}
  1. APIを使用する(Googleドキュメントの例)

    public void onClick(View v) {
    SafetyNet.getClient(this).verifyWithRecaptcha(YOUR_API_SITE_KEY)
        .addOnSuccessListener((Executor) this,
            new OnSuccessListener<SafetyNetApi.RecaptchaTokenResponse>() {
                @Override
                public void onSuccess(SafetyNetApi.RecaptchaTokenResponse response) {
                    // Indicates communication with reCAPTCHA service was
                    // successful.
                    String userResponseToken = response.getTokenResult();
                    if (!userResponseToken.isEmpty()) {
                        // Validate the user response token using the
                        // reCAPTCHA siteverify API.
                    }
                }
        })
        .addOnFailureListener((Executor) this, new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    if (e instanceof ApiException) {
                        // An error occurred when communicating with the
                        // reCAPTCHA service. Refer to the status code to
                        // handle the error appropriately.
                        ApiException apiException = (ApiException) e;
                        int statusCode = apiException.getStatusCode();
                        Log.d(TAG, "Error: " + CommonStatusCodes
                                .getStatusCodeString(statusCode));
                    } else {
                        // A different, unknown type of error occurred.
                        Log.d(TAG, "Error: " + e.getMessage());
                    }
                }
        });
    

    }

于 2018-08-15T02:45:28.313 に答える