0

Google にログインする方法についていくつか質問がありますが、すべての回答は認証と Google API に関するものです。ユーザーが存在するかどうかを確認するためだけに、Googleで簡単にログインしたい(ユーザーアカウントで何もするつもりはありません(メールへのアクセスなど...)。ユーザーはクリック時にメールとパスワードを入力しますhttp 接続によるログイン ボタンのログ記録が行われます. 問題は、間違った電子メール アドレスまたはパスワードを入力しても、ログが継続することです. ログインに間違った Google Web サイトを使用しているかどうかはわかりません.

関数呼び出しと Google ログイン Web サイトは次のとおりです。

new LoginIntoGoogle().execute(new String[] {"https://accounts.google.com/ServiceLogin?"});

これは、コードが行っていることです:

private class LoginIntoGoogle extends AsyncTask<String, Void, String> {
    @Override
    protected String doInBackground(String... url) {
        // Start HTTP connection and send the database to the web server
        DefaultHttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(url[0]);

        try {
            // Add your data
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
            nameValuePairs.add(new BasicNameValuePair("Email", ""+userEmail));
            nameValuePairs.add(new BasicNameValuePair("Passwd", ""+passtext.getText().toString().trim()));
            nameValuePairs.add(new BasicNameValuePair("signIn", "Login"));

            // Execute HTTP Post Request
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            HttpResponse response = httpclient.execute(httppost);

            if (response.getStatusLine().getStatusCode() < 300 && response.getStatusLine().getStatusCode() >= 200) {
               System.out.println(response.getStatusLine().getStatusCode());

               Editor editor = mPrefs.edit();
               editor.putString("login_status", "Logged into your google account");
               editor.commit();

               return "Logged into your google account";
            }
            else {
               Editor editor = mPrefs.edit();
               editor.putString("login_status", "Problem to login into your google account");
               editor.commit();

               return "Problem to login into your google account";
            }
4

2 に答える 2

0

最近リリースされた Google Playstore サービスをチェックしてください。ドキュメントを読んでください。PlayStoreサービスに関する Google IO のビデオをご覧ください。

お役に立てれば。

于 2012-10-05T06:17:55.817 に答える
0

インターネット経由で個人データを転送するため、暗号化を使用する必要があります。

Oauthを調べる必要があります

于 2012-10-05T03:10:09.370 に答える