当前位置: 首页>>代码示例>>Java>>正文


Java VKAccessToken.currentToken方法代码示例

本文整理汇总了Java中com.vk.sdk.VKAccessToken.currentToken方法的典型用法代码示例。如果您正苦于以下问题:Java VKAccessToken.currentToken方法的具体用法?Java VKAccessToken.currentToken怎么用?Java VKAccessToken.currentToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vk.sdk.VKAccessToken的用法示例。


在下文中一共展示了VKAccessToken.currentToken方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getToken

import com.vk.sdk.VKAccessToken; //导入方法依赖的package包/类
public String getToken() {
    if (Prefs.getString(SyncMaster.GLOBAL_TOKEN, null) != null) {
        return Prefs.getString(SyncMaster.GLOBAL_TOKEN, null);
    } else if (AccessToken.getCurrentAccessToken() != null)
        return AccessToken.getCurrentAccessToken().getToken();
    else if (Twitter.getSessionManager().getActiveSession() != null) {
        TwitterSession session = Twitter.getSessionManager().getActiveSession();
        TwitterAuthToken authToken = session.getAuthToken();
        return authToken.token;
    } else
        return VKAccessToken.currentToken().accessToken;
}
 
开发者ID:KKorvin,项目名称:uPods-android,代码行数:13,代码来源:LoginMaster.java

示例2: requestWithVkRequest

import com.vk.sdk.VKAccessToken; //导入方法依赖的package包/类
/**
 * Prepares new "normal" request from VKRequest
 *
 * @param vkRequest Request, created for some method
 * @return Prepared request for creating VKHttpOperation
 */
public static VKHTTPRequest requestWithVkRequest(@NonNull VKRequest vkRequest) {
    VKAccessToken token = VKAccessToken.currentToken();
    VKHTTPRequest result = new VKHTTPRequest(String.format(Locale.US, "http%s://api.vk.com/method/%s", vkRequest.secure || (token != null && token.httpsRequired) ? "s" : "", vkRequest.methodName));
    result.headers = getDefaultHeaders();
    result.setVkParameters(vkRequest.getPreparedParameters());
    return result;
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:14,代码来源:VKHttpClient.java

示例3: getPreparedParameters

import com.vk.sdk.VKAccessToken; //导入方法依赖的package包/类
public VKParameters getPreparedParameters() {
    if (mPreparedParameters == null) {
        mPreparedParameters = new VKParameters(mMethodParameters);

        //Set current access token from SDK object
        VKAccessToken token = VKAccessToken.currentToken();
        if (token != null) {
            mPreparedParameters.put(VKApiConst.ACCESS_TOKEN, token.accessToken);
            if (token.httpsRequired) {
                this.secure = true;
            }
        }
        //Set actual version of API
        mPreparedParameters.put(VKApiConst.VERSION, VKSdk.getApiVersion());
        //Set preferred language for request
        mPreparedParameters.put(VKApiConst.LANG, getLang());

        if (this.secure) {
            //If request is secure, we need all urls as https
            mPreparedParameters.put(VKApiConst.HTTPS, "1");
        }
        if (token != null && token.secret != null) {
            //If it not, generate signature of request
            String sig = generateSig(token);
            mPreparedParameters.put(VKApiConst.SIG, sig);
        }
        //From that moment you cannot modify parameters.
        //Specially for http loading
    }
    return mPreparedParameters;
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:32,代码来源:VKRequest.java

示例4: processCommonError

import com.vk.sdk.VKAccessToken; //导入方法依赖的package包/类
private boolean processCommonError(final VKError error) {
    //TODO: lock thread, if ui required, release then
    if (error.errorCode == VKError.VK_API_ERROR) {
        final VKError apiError = error.apiError;

        VKSdk.notifySdkAboutApiError(apiError);

        if (apiError.errorCode == 16) {
            VKAccessToken token = VKAccessToken.currentToken();
            if (token != null) {
                token.httpsRequired = true;
                token.save();
            }
            repeat();

            return true;
        } else if (shouldInterruptUI) {
            apiError.request = this;
            if (error.apiError.errorCode == 14) {
                this.mLoadingOperation = null;
                VKServiceActivity.interruptWithError(context, apiError, VKServiceActivity.VKServiceType.Captcha);
                return true;
            } else if (apiError.errorCode == 17) {
                VKServiceActivity.interruptWithError(context, apiError, VKServiceActivity.VKServiceType.Validation);
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:32,代码来源:VKRequest.java

示例5: onReceiveStatic

import com.vk.sdk.VKAccessToken; //导入方法依赖的package包/类
private static void onReceiveStatic(final Context ctx, boolean forceOurUser) {
    if (isActiveNetwork(ctx) && VKSdk.isIsPaymentsEnable()) {
        if (VKAccessToken.currentToken() == null && !tracker.isTracking()) {
            tracker.startTracking();
        }
        checkUserInstall(ctx, forceOurUser);
    }
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:9,代码来源:VKPaymentsReceiver.java

示例6: updateMenuStatus

import com.vk.sdk.VKAccessToken; //导入方法依赖的package包/类
private void updateMenuStatus() {
    if (optionsMenu == null) {
        return;
    }
    boolean isLoggedIn = VKAccessToken.currentToken() != null;
    optionsMenu.findItem(R.id.menuItemLogin).setEnabled(!isLoggedIn);
    optionsMenu.findItem(R.id.menuItemLoadBeginning).setEnabled(isLoggedIn);
    optionsMenu.findItem(R.id.menuItemLogout).setEnabled(isLoggedIn);
}
 
开发者ID:yeputons,项目名称:ofeed,代码行数:10,代码来源:MainActivity.java


注:本文中的com.vk.sdk.VKAccessToken.currentToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。