androidfacebookfacebook-loginandroid-facebook

Login with facebook crash the app if using FaceBook Lite


In my app I'm using facebook SDK to perform a login and register methods.

It's Okay when I have the general FaceBook application or using normal web-browser on my device.

But when I have FaceBook Lite on my device and I don't have the general FaceBook application, when I try to login/sign up using the facebook-sdk the app just close without any log/messages, So I can't know why this issue happened.

How can I fix that issue? - Can I skip FaceBook Lite app and use browser instead?

Update:

Here is a video if I have normal facebook app, no problems.

Here is a video if I have the face book app lite on my device, which make it crash.

My code snippet:

LoginManager.getInstance()
                    .logInWithReadPermissions(getActivity(), Arrays.asList("public_profile"));

            LoginManager.getInstance()
                    .registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
                        @Override
                        public void onSuccess(final LoginResult loginResult) {
                            Log.i("MainActivity", "@@@onSuccess");
                            GraphRequest request = GraphRequest
                                    .newMeRequest(loginResult.getAccessToken(),
                                            (object, response) -> {
                                                Log.i("MainActivity",
                                                        "@@@response: " + response.toString());

                                                try {

                                                    ///
                                                } catch (JSONException e) {
                                                    ////

                                                }
                                            });

                        }

                        @Override
                        public void onCancel() {
                            Log.i("MainActivity", "@@@onCancel");
                        }

                        @Override
                        public void onError(FacebookException error) {
                            Log.i("MainActivity", "@@@onError: " + error.getMessage());
                        }

                    });

Solution

  • Well, I was getting wired behaviors in some LOLIPOP device the app close even before openning the Facebook native application, and in other devices the app close with facebook lite only, However.

    I'm was using noHistory=true attribute on the activity so the activity deleted from stack once the dialog appear due to calling onStop().

    <activity
            android:name=".AuthActivity"
            android:screenOrientation="portrait"
            android:noHistory="true"
            android:windowSoftInputMode="stateHidden" />
    

    After removing that attribute, Now it's worked Fine!