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


Java VKCallback类代码示例

本文整理汇总了Java中com.vk.sdk.VKCallback的典型用法代码示例。如果您正苦于以下问题:Java VKCallback类的具体用法?Java VKCallback怎么用?Java VKCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onActivityResult

import com.vk.sdk.VKCallback; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    mTwitterAuthClient.onActivityResult(requestCode, resultCode, data);
    if (!VKSdk.onActivityResult(requestCode, resultCode, data, new VKCallback<VKAccessToken>() {
        @Override
        public void onResult(VKAccessToken token) {
            initUIAfterLogin();
        }

        @Override
        public void onError(VKError error) {
        }
    })) {
        super.onActivityResult(requestCode, resultCode, data);
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
开发者ID:KKorvin,项目名称:uPods-android,代码行数:19,代码来源:FragmentProfile.java

示例2: onActivityResult

import com.vk.sdk.VKCallback; //导入依赖的package包/类
@Override
public void onActivityResult( int requestCode, int resultCode, Intent data ) {
	if( !VKSdk.onActivityResult( requestCode, resultCode, data, new VKCallback<VKAccessToken>() {
		@Override
		public void onResult( VKAccessToken res ) {
			AIR.log( "AuthFunction::onActivityResult | VK_AUTH_SUCCESS" );
			AIR.dispatchEvent( AIRVKEvent.VK_AUTH_SUCCESS, VKAccessTokenUtils.toJSON( res ) );
		}

		@Override
		public void onError( VKError error ) {
			AIR.log( "AuthFunction::onActivityResult | VK_AUTH_ERROR: " + error.errorMessage + " reason: " + error.errorReason );
			AIR.dispatchEvent( AIRVKEvent.VK_AUTH_ERROR, (error.errorMessage == null) ? "Error - user denied access." : error.errorMessage );
		}
	} ) ) {
		AIR.log( "AuthFunction::onActivityResult | no callback" );
	}
	AndroidActivityWrapper.GetAndroidActivityWrapper().removeActivityResultListener( this );
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:20,代码来源:AuthFunction.java

示例3: onActivityResult

import com.vk.sdk.VKCallback; //导入依赖的package包/类
@Override
protected void onActivityResult(final int requestCode, int resultCode, Intent data) {
    if (!VKSdk.onActivityResult(requestCode, resultCode, data, new VKCallback<VKAccessToken>() {
        @Override
        public void onResult(final VKAccessToken accessToken) {
            createUserComponentAndLaunchMainActivity();
        }

        @Override
        public void onError(VKError error) {
            new AlertDialog.Builder(LoginActivity.this)
                    .setMessage("Login failed: " + error.errorReason)
                    .setPositiveButton(android.R.string.ok, null)
                    .show();
        }
    })) {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:20,代码来源:LoginActivity.java

示例4: onActivityResult

import com.vk.sdk.VKCallback; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (!VKSdk.onActivityResult(requestCode, resultCode, data, new VKCallback<VKAccessToken>() {
        @Override
        public void onResult(VKAccessToken res) {
            Log.i(LOG_TAG, "VKAccessToken: " + res);
            // User passed Authorization
            loadUser("onActivityResult");
        }
        @Override
        public void onError(VKError error) {
            // User didn't pass Authorization
            Log.e(LOG_TAG, "onActivityResult.onError: " + error);
        }
    })) {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
开发者ID:DmitriyG1,项目名称:vk-music-player-android,代码行数:19,代码来源:LoginActivity.java

示例5: onActivityResult

import com.vk.sdk.VKCallback; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    VKCallback<VKAccessToken> callback = new VKCallback<VKAccessToken>() {
        @Override
        public void onResult(VKAccessToken res) {
            // User passed Authorization
            startTestActivity();
        }

        @Override
        public void onError(VKError error) {
            // User didn't pass Authorization
        }
    };

    if (!VKSdk.onActivityResult(requestCode, resultCode, data, callback)) {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
开发者ID:VKCOM,项目名称:vk-android-sdk,代码行数:20,代码来源:LoginActivity.java

示例6: call

import com.vk.sdk.VKCallback; //导入依赖的package包/类
@Override
public FREObject call( FREContext context, FREObject[] args ) {
	super.call( context, args );

	boolean enableLogs = FREObjectUtils.getBoolean( args[1] );
	AIR.setLogEnabled( enableLogs );
	VKSdk.DEBUG = enableLogs;
	int appId = Integer.valueOf( FREObjectUtils.getString( args[0] ) );

	AIR.log( "Initializing VKSdk" );

	Activity activity = AIR.getContext().getActivity();

	AIR.startAccessTokenTracker();
	VKSdk.customInitialize( activity, appId, "" );
	VKSdk.wakeUpSession( activity, new VKCallback<VKSdk.LoginState>() {
		@Override
		public void onResult( VKSdk.LoginState res ) {
			AIR.log( "VKSdk.wakeUpSession::onResult " + res );
			AIR.notifyTokenChange( VKAccessToken.currentToken() );
		}

		@Override
		public void onError( VKError error ) {
			AIR.log( "VKSdk.wakeUpSession::onError " + error.errorReason );
			AIR.notifyTokenChange( VKAccessToken.currentToken() );
		}
	} );

	return null;
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:32,代码来源:InitFunction.java

示例7: onCreate

import com.vk.sdk.VKCallback; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_login);

    ActionBar actionBar = getActionBar();
    if(actionBar != null){
        actionBar.hide();
    }

    /*String[] fingerprints = VKUtil.getCertificateFingerprint(this, this.getPackageName());
    if(fingerprints != null){
        for(int i = 0; i < fingerprints.length; i++){
            Log.i(LOG_TAG, "fingerprints: " + fingerprints[i]);
        }
    }else {
        Log.i(LOG_TAG, "fingerprints is null");
    }*/

    VKSdk.wakeUpSession(this, new VKCallback<VKSdk.LoginState>() {
        @Override
        public void onResult(VKSdk.LoginState res) {
            Log.i(LOG_TAG, "VKSdk.LoginState: "  + res + ", isLoggedIn: " + VKSdk.isLoggedIn());

            switch (res) {
                case LoggedOut:
                    showLogin();
                    break;
                case LoggedIn:
                    loadUser("wakeUpSession LoggedIn");
                    break;
                case Pending:
                    break;
                case Unknown:
                    break;
            }
        }

        @Override
        public void onError(VKError error) {
            Log.e(LOG_TAG, "VKError: "  + error);
        }
    });
}
 
开发者ID:DmitriyG1,项目名称:vk-music-player-android,代码行数:46,代码来源:LoginActivity.java

示例8: onCreate

import com.vk.sdk.VKCallback; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);
        VKSdk.wakeUpSession(this, new VKCallback<VKSdk.LoginState>() {
            @Override
            public void onResult(VKSdk.LoginState res) {
                if (isResumed) {
                    switch (res) {
                        case LoggedOut:
                            showLogin();
                            break;
                        case LoggedIn:
                            showLogout();
                            break;
                        case Pending:
                            break;
                        case Unknown:
                            break;
                    }
                }
            }

            @Override
            public void onError(VKError error) {

            }
        });

//        String[] fingerprint = VKUtil.getCertificateFingerprint(this, this.getPackageName());
//        Log.d("Fingerprint", fingerprint[0]);
    }
 
开发者ID:VKCOM,项目名称:vk-android-sdk,代码行数:33,代码来源:LoginActivity.java


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