parse-community / ParseFacebookUtils-Android

A utility library to authenticate ParseUsers with the Facebook SDK
http://docs.parseplatform.org/android/guide/#facebook-users
Other
53 stars 63 forks source link

Callback method not getting called in "login with facebook" button click workflow #13

Closed ishandutta2007 closed 8 years ago

ishandutta2007 commented 8 years ago

I copied the code as given in your example to an activity named LoginActivity. When I click "login with facebook" the facebook popup shows up but on canceling the fb popup it's not even reaching the done method inside callback. However if I click the button again, it reaches there directly with user=null, without even showing the popup this time.

public static final List<String> mPermissions = new ArrayList<String>() {{
    add("public_profile");
    add("email");
}};   
@Bind(R.id.btn_fb_login) Button _mBtnFb;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);

    _mBtnFb.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ParseFacebookUtils.logInWithReadPermissionsInBackground(LoginActivity.this, mPermissions, new LogInCallback() {
                @Override
                public void done(ParseUser user, ParseException err) {
                    Log.d("tag", "Is it reaching here");//On canceling the fb popup it's not even reaching here. However if I click button again, it reaches here directly with user=null, without even showing the popup
                    if (user == null) {
                        Log.d("tag", "Uh oh. The user cancelled the Facebook login.");
                    } else if (user.isNew()) {
                        Log.d("Tag", "User signed up and logged in through Facebook!");
                        getUserDetailsFromFB();
                    } else {
                        Log.d("tag", "User logged in through Facebook!");
                        getUserDetailsFromParse();
                    }
                }
            });

        }
    });
}

The logcat when I click the button for first time is as follows:

12-26 00:49:48.676 10804-10804/com.grafixartist.parseapp I/WebViewFactory: Loading com.android.webview version 39 (eng.buildbot-x86) (code 399997)
12-26 00:49:48.682 10804-10804/com.grafixartist.parseapp I/LibraryLoader: Time to load native libraries: 1 ms (timestamps 9945-9946)
12-26 00:49:48.682 10804-10804/com.grafixartist.parseapp I/LibraryLoader: Expected native library version number "",actual native library version number ""
12-26 00:49:48.688 10804-10804/com.grafixartist.parseapp V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {81ea002}
12-26 00:49:48.688 10804-10804/com.grafixartist.parseapp I/LibraryLoader: Expected native library version number "",actual native library version number ""
12-26 00:49:48.688 10804-10804/com.grafixartist.parseapp I/chromium: [INFO:library_loader_hooks.cc(104)] Chromium logging enabled: level = 0, default verbosity = 0
12-26 00:49:48.692 10804-10804/com.grafixartist.parseapp I/BrowserStartupController: Initializing chromium process, singleProcess=true
12-26 00:49:48.693 10804-10804/com.grafixartist.parseapp W/art: Attempt to remove local handle scope entry from IRT, ignoring
12-26 00:49:48.713 10804-11030/com.grafixartist.parseapp W/AudioManagerAndroid: Requires BLUETOOTH permission
12-26 00:49:48.716 10804-10804/com.grafixartist.parseapp W/chromium: [WARNING:resource_bundle.cc(304)] locale_file_path.empty()
12-26 00:49:48.716 10804-10804/com.grafixartist.parseapp I/chromium: [INFO:aw_browser_main_parts.cc(65)] Load from apk succesful, fd=44 off=46184 len=3037
12-26 00:49:48.716 10804-10804/com.grafixartist.parseapp I/chromium: [INFO:aw_browser_main_parts.cc(78)] Loading webviewchromium.pak from, fd:45 off:229484 len:1089587
12-26 00:49:48.776 10804-10804/com.grafixartist.parseapp W/chromium: [WARNING:mailbox_synchronizer.cc(41)] MailboxSync not supported due to missing EGL image/fence support
12-26 00:49:48.872 10804-10804/com.grafixartist.parseapp W/chromium: [WARNING:data_reduction_proxy_settings.cc(331)] SPDY proxy OFF at startup
12-26 00:49:48.914 10804-10804/com.grafixartist.parseapp W/art: Attempt to remove local handle scope entry from IRT, ignoring
12-26 00:49:48.916 10804-10804/com.grafixartist.parseapp W/AwContents: onDetachedFromWindow called when already detached. Ignoring
12-26 00:49:49.055 10804-10848/com.grafixartist.parseapp W/EGL_emulation: eglSurfaceAttrib not implemented
12-26 00:49:49.056 10804-10848/com.grafixartist.parseapp W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3f959a0, error=EGL_SUCCESS
12-26 00:49:49.142 10804-10848/com.grafixartist.parseapp W/EGL_emulation: eglSurfaceAttrib not implemented
12-26 00:49:49.147 10804-10848/com.grafixartist.parseapp W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3f95280, error=EGL_SUCCESS
12-26 00:49:49.558 10804-10848/com.grafixartist.parseapp W/EGL_emulation: eglSurfaceAttrib not implemented
12-26 00:49:49.558 10804-10848/com.grafixartist.parseapp W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3f57120, error=EGL_SUCCESS
12-26 00:49:51.736 10804-10848/com.grafixartist.parseapp E/chromium: [ERROR:buffer_manager.cc(313)] [.Parent-Compositor-0xce0404e0]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command
12-26 00:49:52.087 10804-10804/com.grafixartist.parseapp I/Choreographer: Skipped 33 frames!  The application may be doing too much work on its main thread.
12-26 00:49:52.721 10804-10804/com.grafixartist.parseapp I/Choreographer: Skipped 37 frames!  The application may be doing too much work on its main thread.

Edit: However if I write entire login code inside main activity it works. currently login activity is called from main activity like this:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Intent intent = new Intent(this, LoginActivity.class);
    startActivityForResult(intent, successfulLogin);
}
grantland commented 8 years ago

Could you post the entire contents of LoginActivity? Are you sure you're calling all the require methods like ParseFacebookUtils#onActivityResult()? Does the callback work for the normal case of logging in?

Could you also include all the information outlined in our Contributing Guidelines such as the version you're using, environment this reproduces on, etc?

parse-github-bot commented 8 years ago

Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.

Please try the latest SDK. Our release notes have details about what issues were fixed in each release.

In addition, you might find the following resources helpful:

parse-github-bot commented 8 years ago

This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback.

parse-github-bot commented 8 years ago

We are closing this issue due to another 7 days of inactivity. If you have additional information to help pinpoint this issue as an SDK bug, please reopen it with the additional information.Thank you for your feedback.