简体   繁体   中英

Authenticate using Box Android SDK v2

I want to authenticate using the Box SDK.

I got the Box Java SDK V2 and the Box Android SDK V2 . And I'm using the basic authentication code from the Box Android SDK

Intent intent = OAuthActivity.createOAuthActivityIntent(this, clientId, 
    clientSecret);
startActivityForResult(intent);

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_CANCELED) {
        // Get the error message for why authentication failed.
        String failMessage = data.getStringExtra(OAuthActivity.ERROR_MESSAGE);
        // Implement your own logic to handle the error.
       handleFail(failMessage);
    } else {
        // You will get an authenticated BoxClient object back upon success.
        BoxClient client =
            data.getParcelableExtra(OAuthActivity.BOX_CLIENT);
        youOwnMethod(client);
    }
}

but I'm getting this error:

The method createOAuthActivityIntent(Context, String, String) from the type OAuthActivity refers to the missing type Intent

It's probably something stupid I'm doing wrong, but can someone tell me what?

It seems Intent class cannot be found? This is an android class. Are you working on an android project or a regular java project? Do you see any compile error?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM