0

I am running Glympse Sdk sample on my Android Studio 3.0, I am able to run the sample but finding some issue like sdk is not properly working with Studio, Please refer the below dropbox link for see screen shot:-

https://www.dropbox.com/personal?preview=Glympse.png

Project is running, but I am not able to get signed inside Glympse using any of the account and neither by Skipping login.

I am using this function for Facebook :-

public void fbLogin() {
        LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList(this.getString(R.string.fb_email), this.getString(R.string.fb_public_profile)));
        LoginManager.getInstance().registerCallback(_callbackManager, new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                mSocialFbToken = com.facebook.AccessToken.getCurrentAccessToken().getToken().toString();
                GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
                    @Override
                    public void onCompleted(JSONObject object, GraphResponse response) {
                        try {
                            GPrimitive profile = GlympseFactory.createFacebookAccountProfile(mSocialFbToken);
                            GlympseWrapper.instance().getGlympse().logout();
                            GlympseWrapper.instance().getGlympse().login(profile);
                            GlympseWrapper.instance().getGlympse().start();

                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                });
                Bundle parameters = new Bundle();
                parameters.putString("fields", "id, name, email, first_name,birthday,last_name,gender");
                request.setParameters(parameters);
                request.executeAsync();
            }

            @Override
            public void onCancel() {

            }

            @Override
            public void onError(FacebookException error) {
                if (error instanceof FacebookAuthorizationException) {
                    if (com.facebook.AccessToken.getCurrentAccessToken() != null) {
                        LoginManager.getInstance().logOut();
                        fbLogin();
                    }
                }
            }
        });
    }

Please refer the bellow link:-

https://www.dropbox.com/s/9ao6pl532pmumiw/glypseFbLoginProcess.png?dl=0

After execution of line:-

GPrimitive profile = GlympseFactory.createFacebookAccountProfile(mSocialFbToken);

Here, is what I got in evaluating GPrimitive Object :-

https://www.dropbox.com/s/w6n3fj0l7eq3hnx/glympsecreate.png?dl=0

My debugging got stop at this piece of call back :-

@Override
    public void eventsOccurred(GGlympse glympse, int listener, int events, Object obj) {
        if (GE.LISTENER_PLATFORM == listener) {
            if (0 != (events & GE.PLATFORM_ACCOUNT_CREATE_FAILED)) {
                // Check for a failure to create a Glympse account. This can happen for several reasons,
                // but in this case, it's most likely invalid or expired tokens from a third-party service.
                Toast.makeText(this, "Error: Federated login failed.", Toast.LENGTH_LONG).show();

                setTitle("Account Linking", false);
            }
            if (0 != (events & GE.PLATFORM_SYNCED_WITH_SERVER)) {
                // If we successfully sync with the server, then we have a valid Glympse user account and
                // up-to-date access tokens, so show the "account linking" view from which the user can
                // choose to link new accounts, unlink existing accounts or logout.
                Intent intent = new Intent(this, LinkedAccountsActivity.class);
                startActivity(intent);

                setTitle("Account Linking", false);
            }
        }
    }

Seems to be something not matching, but when I tried to evaluate GE.LISTENER_PLATFORM it said that unable to find any local variable GE

Please let me know what I need to update or place in my code so that it starts recognising the following two packages:-

  1. com.glympse.android.api
  2. com.glympse.android.core

Here is my setting.gradle file :-

include ':accountLinkingDemo' include ':GlympseApi' project(':GlympseApi').projectDir = new File('../GlympseApi')

Please let me know what I am left with, or what I am doing wrong in this. I have followed every step mentioned in Get Started Process on Glympse home page:-

https://developer.glympse.com/docs/core/client-sdk/guides/platforms/intro-android

I am new to this SDk and want to learn how it exactly works so that I can see this in my application.

I tried to resolve these compatibility issues but still Glympse Api's are not getting recognised by studio.

Have any one face this problem before? Any Help will be Appreciated!!!

Thanks.

Fenil Patel
  • 1,528
  • 11
  • 28
user2028
  • 163
  • 4
  • 15
  • 40
  • It seems like the GlympseApi and its packages are reachable, otherwise it would be unable to build and GlympseFactory. createFacebookAccountProfile would not work. Does your imports list contain import com.glympse.android.api.GE? Possibly it was an ambiguous import and selected the wrong GE. – Nick Glickenhouse Dec 28 '17 at 17:58
  • @NickGlickenhouse thanks for your reply , is there any solution to this ? i have put all required dependencies inside my gradle file , is this something related to incompatibility with studio version or anything else ...please suggest me the way or should i try to re-import it in some another studio version like in 2.0.3 ? – user2028 Dec 29 '17 at 04:07
  • Solved!!! , The problem was with gradle version , the studio was not recognizing imports when gradle version was 3.0.0-alpha3 , when i changed it to com.android.tools.build:gradle:2.2.3' and added distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip in wrapper properties , Studio start recognizing all imports. – user2028 Dec 29 '17 at 06:12
  • now start getting this error :- Process: com.glympse.android.demo.accountlinking, PID: 14167 java.lang.RuntimeException: Unable to resume activity {com.glympse.android.demo.accountlinking/com.glympse.android.demo.accountlinking.LinkedAccountsActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'com.glympse.android.api.GUserManager com.glympse.android.api.GGlympse.getUserManager()' on a null object reference – user2028 Dec 29 '17 at 13:25
  • It seems like you are modifying the LinkedAccounts Demo so I'm assuming the code is still trying to fetch the _glympse object in GlympseWrapper but it is returning null. Is the createGlympse method in GlympseWrapper no longer being called or is that object otherwise being nulled at some point? – Nick Glickenhouse Dec 29 '17 at 17:13
  • @NickGlickenhouse , sir , i haven't modified anything in code. – user2028 Jan 02 '18 at 04:45
  • adding compile 'com.android.support:appcompat-v7:26.0.0' , works for me , now demo is working . – user2028 Jan 02 '18 at 05:44

0 Answers0