How to link Google + signed in users on Parse backend on Android?

后端 未结 5 722
名媛妹妹
名媛妹妹 2020-12-14 07:58

I\'ve been using Parse for 3 months in my android app. Now I want to add email login and social sign ons (Facebook and Google+) in the app. I have successfully added email a

5条回答
  •  半阙折子戏
    2020-12-14 08:41

    To do so, I have used the following code

      ParseUser.becomeInBackground(ParseUser.getCurrentUser().getSessionToken(), new LogInCallback() {
                        @Override
                        public void done(ParseUser parseUser, ParseException e) {
                            if (parseUser != null) {
                                parseUser.setUsername(userEmail);
    //firstName and lastName I am getting from Person class of google plus api
                                parseUser.put("FirstName", firstName);
                                parseUser.put("LastName", lastName);
    
                                parseUser.saveInBackground();
    
                                ParseUtils.verifyParseConfiguration(context);
                                ParseUtils.subscribeWithUsername(strEmail);
                                Intent successIntent = new Intent(context, OurServicesActivity.class);
                                startActivity(successIntent);
                                overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
                                finish();
                            } else {
                                Log.e(TAG, e.getMessage());
                                Utilities.showToast(context, "Something occurred");
                            }
                        }
                    });
    

    Let me know if it helps or if you have used something else.

提交回复
热议问题