box / box-android-preview-sdk

Box Android Preview SDK
Apache License 2.0
13 stars 10 forks source link

SDK losing Session #3

Closed rjong closed 7 years ago

rjong commented 7 years ago

Hello,

We want to use the preview SDK in our Android app. The BoxSession is created with the following code:

BoxAuthentication.BoxAuthenticationInfo info = new BoxAuthentication.BoxAuthenticationInfo();
info.setAccessToken(accessToken); // accessToken is the Box Access Token as String
session = new BoxSession(getApplicationContext(), info, this); // 'This' is the refreshListener
session.authenticate();

For previewing the document we do: startActivityForResult(BoxPreviewActivity.getLaunchIntent(getApplicationContext(), session, file), 100); // file is the BoxFile

When clicking on a document the activity will launch, but crashes with the following error:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.box.androidsdk.content.models.BoxUser.getId()' on a null object reference

We've checked the session and it seems that the session has all the right values. When we put breakpoints in the code and SDK, we see that in the middle of the SDK, the session loses its values.

What to do?

doncung commented 7 years ago

Sorry for the late reply, we believe this functionality should be working in the latest sdk. Please let us know if you are still seeing an error.