Android login and authenticate facebook user into a backendless mbaas application -
i have done upto code below , can succesfully authenticate , login facebook user.
i have compile 'com.backendless:backendless:3.0.15.1'
in build gradle.
private facebookcallback<loginresult> mcallback = new facebookcallback<loginresult>() { @override public void onsuccess(loginresult loginresult) { // mdialog.dismiss(); graphrequest request = graphrequest.newmerequest( loginresult.getaccesstoken(), new graphrequest.graphjsonobjectcallback() { @override public void oncompleted(jsonobject object, graphresponse response) { log.e("response: ", response + ""); user = new user(); user.facebookid = object.optstring("id"); user.name = object.optstring("name"); user.email = object.optstring("email"); user.gender = object.optstring("gender"); user.locale = object.optstring("locale"); utils.setcurrentuser(user, loginactivity.this); startactivity(new intent(loginactivity.this, mainactivity.class)); finish(); toast.maketext(loginactivity.this, "logged in " + user.name, toast.length_long).show(); } } ); bundle parameters = new bundle(); parameters.putstring("fields", "id, name, email, gender, locale, birthday, picture.width(80).height(80)"); request.setparameters(parameters); request.executeasync(); } @override public void oncancel() { log.i(tag, "loginbutton facebookcallback oncancel"); } @override public void onerror(facebookexception error) { log.i(tag, "loginbutton facebookcallback onerror:: "+error.getmessage()); log.i(tag, "exception:: "+error.getstacktrace()); } };
Comments
Post a Comment