本文整理汇总了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);
}
}
示例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 );
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
});
}
示例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]);
}