0

am developing an app where user can login by clicking login button with facebook.For facebook login i added library etc for facebook. i have tried everything to get keyhash but still i am unable to get key hash for development of facebook login for my app.

i have added this C:\Program Files\Java\jdk1.8.0_112\jre\bin and this C:\OpenSSL\bin . i tried with the method given in different sites but still some problem ..kindly help

here is my Login.java

public class Login extends AppCompatActivity {
    private  String eml;
    private  String pswrd;

    private ProgressDialog pDialog;
    String status="";

    Button login;

   // private int serverResponseCode = 0;
    TextView tac1;
    EditText email,pass;
  private static String url_create_book = "http://cloud....com/broccoli/login.php";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        email=(EditText)findViewById(R.id.email);
        pass=(EditText)findViewById(R.id.password);

        tac1 = (TextView) findViewById(R.id.cAcc);
        tac1.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {

              startActivity(new Intent(Login.this, RegistrationForm.class));

            }
        });

        login=(Button)findViewById(R.id.lbtn);
        login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


                    pDialog = new ProgressDialog(Login.this);
                    pDialog.setMessage("Please wait..");
                    pDialog.setIndeterminate(false);
                    pDialog.setCancelable(true);
                    pDialog.show();
                    eml = email.getText().toString();
                    pswrd = pass.getText().toString();


               // new CreateNewProduct().execute();
                    StringRequest stringRequest = new StringRequest(Request.Method.POST, url_create_book,
                            new Response.Listener<String>() {
                                @Override
                                public void onResponse(String response) {
                                    pDialog.dismiss();
                                    if (response.trim().equals("success")) {
                                        Toast.makeText(Login.this,"Login Success",Toast.LENGTH_SHORT).show();

//your intent code here
                                    } else {
                                        Toast.makeText(Login.this,"username/password incorrect",Toast.LENGTH_SHORT).show();

                                    }
                                }
                            },
                            new Response.ErrorListener() {
                                @Override
                                public void onErrorResponse(VolleyError error) {
                                    pDialog.dismiss();
                                    Toast.makeText(Login.this, error.toString(), Toast.LENGTH_LONG).show();
                                }
                            })
                    {
                        @Override
                        protected Map<String, String> getParams() {
                            Map<String, String> params = new HashMap<String, String>();
                            params.put("email", eml);
                            params.put("password",pswrd);

                            return params;
                        }
                    };
                    RequestQueue requestQueue = Volley.newRequestQueue(Login.this);
                    requestQueue.add(stringRequest);

            }

        });

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

}
rafsanahmad007
  • 23,683
  • 6
  • 47
  • 62
z.al
  • 279
  • 1
  • 6
  • 21
  • keyhash for facebook api?? – siddhesh Jan 02 '17 at 07:55
  • 1
    Possible duplicate of [How to create Android Facebook Key Hash?](http://stackoverflow.com/questions/7506392/how-to-create-android-facebook-key-hash) – Nilesh Singh Jan 02 '17 at 08:02
  • yes i want to make button where if u click u can login with facebook – z.al Jan 02 '17 at 08:04
  • i tried that also but still not getting@nilesh singh – z.al Jan 02 '17 at 08:07
  • Just follow the Facebook tutorial, they mentioned block of code where you have straight-forward examples how to do this. Nevertheless you can find a test-hash in your logs when initializing Facebook sdk. – Yurii Tsap Jan 02 '17 at 08:49

0 Answers0