• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VKError类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onActivityResult

import com.vk.sdk.api.VKError; //导入依赖的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: onClick

import com.vk.sdk.api.VKError; //导入依赖的package包/类
@Override
public void onClick(View view) {
	setIsLoading(true);
	if (mAttachmentImages != null && VKSdk.getAccessToken() != null) {
		final Long userId = Long.parseLong(VKSdk.getAccessToken().userId);
		VKUploadWallPhotoRequest photoRequest = new VKUploadWallPhotoRequest(mAttachmentImages, userId, 0);
		photoRequest.executeWithListener(new VKRequest.VKRequestListener() {
			@Override
			public void onComplete(VKResponse response) {
				VKPhotoArray photos = (VKPhotoArray) response.parsedModel;
				VKAttachments attachments = new VKAttachments(photos);
				makePostWithAttachments(attachments);
			}

			@Override
			public void onError(VKError error) {
				setIsLoading(false);
				if (mListener != null) {
					mListener.onVkShareError(error);
				}
			}
		});
	} else {
		makePostWithAttachments(null);
	}
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:27,代码来源:VKShareDialogDelegate.java


示例3: onActivityResult

import com.vk.sdk.api.VKError; //导入依赖的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


示例4: removeAudio

import com.vk.sdk.api.VKError; //导入依赖的package包/类
private void removeAudio(VKApiAudio audio, int position) {
    VKApi.audio().delete(VKParameters.from("audio_id", audio.id, "owner_id", audio.owner_id)).executeWithListener(new VKRequest.VKRequestListener() {
        @Override
        public void onComplete(VKResponse response) {
            try {
                int responseCode = response.json.getInt("response");
                if (responseCode == 1) {
                    audioArray.remove(position);
                    adapter.notifyItemRemoved(position);
                    Snackbar.make(binding.getRoot(), R.string.track_removed, Snackbar.LENGTH_SHORT).show();
                }
            } catch (JSONException e) {
                onError(null);
            }
        }

        @Override
        public void onError(VKError error) {
            Snackbar.make(binding.getRoot(), R.string.error_deleting_track, Snackbar.LENGTH_LONG).show();
        }
    });
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:23,代码来源:AudioListFragment.java


示例5: onActivityResult

import com.vk.sdk.api.VKError; //导入依赖的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


示例6: onActivityResult

import com.vk.sdk.api.VKError; //导入依赖的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


示例7: checkAndSetToken

import com.vk.sdk.api.VKError; //导入依赖的package包/类
/**
 * Check new access token and sets it as working token
 *
 * @param tokenParams params of token
 * @param renew       flag indicates token renewal
 * @return true if access token was set, or error was provided
 */
private static CheckTokenResult checkAndSetToken(Map<String, String> tokenParams, boolean renew) {

    VKAccessToken token = VKAccessToken.tokenFromParameters(tokenParams);
    if (token == null || token.accessToken == null) {
        if (tokenParams.containsKey(VKAccessToken.SUCCESS)) {
            return CheckTokenResult.Success;
        }

        VKError error = new VKError(tokenParams);
        if (error.errorMessage != null || error.errorReason != null) {
            setAccessTokenError(error);
            return CheckTokenResult.Error;
        }
    } else {
        setAccessToken(token, renew);
        return CheckTokenResult.Success;
    }
    return CheckTokenResult.None;
}
 
开发者ID:DementorAl,项目名称:VkAdmin,代码行数:27,代码来源:VKSdk.java


示例8: checkAndSetToken

import com.vk.sdk.api.VKError; //导入依赖的package包/类
/**
* Check new access token and sets it as working token
* @param tokenParams params of token
* @param renew flag indicates token renewal
   * @return true if access token was set, or error was provided
*/
  private static boolean checkAndSetToken(Map<String, String> tokenParams, boolean renew) {
      VKAccessToken token = VKAccessToken.tokenFromParameters(tokenParams);
      if (token == null || token.accessToken == null) {
          VKError error = new VKError(tokenParams);
          if (error.errorMessage != null || error.errorReason != null) {
              setAccessTokenError(error);
              return true;
          }

      } else {
          setAccessToken(token, renew);
          return true;
      }
      return false;
  }
 
开发者ID:LizaAlert-HotLine,项目名称:AndroidMobileWorkplace,代码行数:22,代码来源:VKSdk.java


示例9: performTokenCheck

import com.vk.sdk.api.VKError; //导入依赖的package包/类
private boolean performTokenCheck(VKAccessToken token, boolean isUserToken) {
    if (token != null) {
        if (token.isExpired()) {
            mListener.onTokenExpired(token);
        }
        else if (token.accessToken != null) {
            if (isUserToken) mListener.onAcceptUserToken(token);
            return true;
        }
        else {
            VKError error = new VKError(VKError.VK_API_CANCELED);
            error.errorMessage = "User token is invalid";
                mListener.onAccessDenied(error);
        }
    }
    return false;
}
 
开发者ID:LizaAlert-HotLine,项目名称:AndroidMobileWorkplace,代码行数:18,代码来源:VKSdk.java


示例10: makePost

import com.vk.sdk.api.VKError; //导入依赖的package包/类
private void makePost(VKAttachments attachments, String message) {
	VKRequest post = VKApi.wall().post(VKParameters.from(VKApiConst.OWNER_ID, "-" + TARGET_GROUP, VKApiConst.ATTACHMENTS, attachments, VKApiConst.MESSAGE, message));
	post.setModelClass(VKWallPostResult.class);
	post.executeWithListener(new VKRequestListener() {
		@Override
		public void onComplete(VKResponse response) {
			if (isAdded()) {
				VKWallPostResult result = (VKWallPostResult) response.parsedModel;
				Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format("https://vk.com/wall-%d_%s", TARGET_GROUP, result.post_id)));
				startActivity(i);
			}
		}

		@Override
		public void onError(VKError error) {
			showError(error.apiError != null ? error.apiError : error);
		}
	});
}
 
开发者ID:VKCOM,项目名称:vk-android-sdk,代码行数:20,代码来源:TestActivity.java


示例11: onActivityResult

import com.vk.sdk.api.VKError; //导入依赖的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


示例12: setPhoto

import com.vk.sdk.api.VKError; //导入依赖的package包/类
public void setPhoto(final ImageView imageView, final Button button){
    VKParameters params = new VKParameters();
    params.put(VKApiConst.FIELDS, "photo_max_orig");

    VKRequest request = new VKRequest("users.get",params);
    request.executeWithListener(new VKRequest.VKRequestListener() {

        @Override
        public void onComplete(VKResponse response) {
            super.onComplete(response);
            JSONArray resp = null;
            try {
                resp = response.json.getJSONArray("response");
                JSONObject user = resp.getJSONObject(0);
                String photo_max_orig_url = user.getString("photo_max_orig");
                imageView.setVisibility(View.VISIBLE);
                button.setVisibility(View.GONE);
                Glide.with(context).load(photo_max_orig_url).into(imageView);
            } catch (JSONException e) {
                Log.d("VkSdkHelper", String.valueOf(e));
            }
            }

        @Override
        public void onError(VKError error) {
            super.onError(error);
        }
    });
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:30,代码来源:VkSdkHelper.java


示例13: onActivityResult

import com.vk.sdk.api.VKError; //导入依赖的package包/类
public static boolean onActivityResult(int requestCode, int resultCode, @Nullable Intent data, @NonNull VKCallback<VKAccessToken> vkCallback) {
    if (requestCode == VKServiceActivity.VKServiceType.Authorization.getOuterCode()) {
        if (resultCode == VKSdk.RESULT_OK) {
            vkCallback.onResult(VKAccessToken.currentToken());
        } else if (resultCode == VKSdk.RESULT_ERROR) {
            vkCallback.onError((VKError) VKObject.getRegisteredObject(data == null ? 0 : data.getLongExtra(VKSdk.EXTRA_ERROR_ID, 0)));
        }
        return true;
    } else {
        return false;
    }
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:13,代码来源:VKSdk.java


示例14: wakeUpSession

import com.vk.sdk.api.VKError; //导入依赖的package包/类
/**
 * Checks if an access token exist and performs a try to use it again
 *
 * @param context            An application context for store an access token
 * @param loginStateCallback if callback specified, {@link VKCallback#onResult(Object)} method will be called after login state changed
 * @return true, if an access token exists and not expired
 */
public static boolean wakeUpSession(@NonNull final Context context, final VKCallback<LoginState> loginStateCallback) {
    final Context appContext = context.getApplicationContext();
    VKUIHelper.setApplicationContext(appContext);

    VKAccessToken token = VKAccessToken.currentToken();

    if (token != null && token.accessToken != null && !token.isExpired()) {
        forceLoginState(LoginState.Pending, loginStateCallback);
        trackVisitor(new VKRequest.VKRequestListener() {
            @Override
            public void onComplete(VKResponse response) {
                updateLoginState(context, loginStateCallback);
            }

            @Override
            public void onError(VKError error) {
                //Possible double call of access token invalid
                if (error != null && error.apiError != null && error.apiError.errorCode == 5) {
                    onAccessTokenIsInvalid(appContext);
                }
                updateLoginState(context, loginStateCallback);
            }
        });
        return true;
    }
    updateLoginState(context, loginStateCallback);
    return false;
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:36,代码来源:VKSdk.java


示例15: onError

import com.vk.sdk.api.VKError; //导入依赖的package包/类
@Override
public void onError(VKError error) {
    synchronized (this.syncObj) {
        try {
            listener.onError(error);
        } catch (Exception e) {
            // nothing
        }
        isFinish = true;
        syncObj.notifyAll();
    }
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:13,代码来源:VKSyncRequestUtil.java


示例16: show

import com.vk.sdk.api.VKError; //导入依赖的package包/类
public void show(@NonNull Activity activity, Bundle bundle, int reqCode, @Nullable VKError vkError) {
	mVkError = vkError;
	mBundle = bundle;
	mReqCode = reqCode;
	mView = View.inflate(activity, R.layout.vk_open_auth_dialog, null);

	mProgress = mView.findViewById(R.id.progress);
	mWebView = (WebView) mView.findViewById(R.id.copyUrl);

	final Dialog dialog = new Dialog(activity, R.style.VKAlertDialog);
	dialog.setContentView(mView);
	dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
		@Override
		public void onCancel(DialogInterface dialogInterface) {
			dialog.dismiss();
		}
	});
	dialog.setOnDismissListener(this);
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		dialog.getWindow().setStatusBarColor(Color.TRANSPARENT);
	}

	mDialog = dialog;
	mDialog.show();

	loadPage();
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:28,代码来源:VKOpenAuthDialog.java


示例17: interruptWithError

import com.vk.sdk.api.VKError; //导入依赖的package包/类
public static void interruptWithError(Context ctx, VKError apiError, VKServiceType type) {
    Intent intent = createIntent(ctx, type);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(KEY_REQUEST, apiError.registerObject());
    if (ctx != null) {
        ctx.startActivity(intent);
    }
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:9,代码来源:VKServiceActivity.java


示例18: onActivityResult

import com.vk.sdk.api.VKError; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == VKServiceType.Authorization.getOuterCode() || requestCode == VKServiceType.Validation.getOuterCode()) {
        VKSdk.processActivityResult(this, resultCode, data, new VKCallback<VKAccessToken>() {
            @Override
            public void onResult(VKAccessToken res) {
                setResult(VKSdk.RESULT_OK);
                finish();
            }

            @Override
            public void onError(VKError error) {
                Object o = VKObject.getRegisteredObject(getRequestId());
                if (o instanceof VKError) {
                    VKError vkError = ((VKError) o);
                    if (vkError.request != null) {
                        vkError.request.cancel();
                        if (vkError.request.requestListener != null) {
                            vkError.request.requestListener.onError(error);
                        }
                    }
                }

                if (error != null) {
                    setResult(VKSdk.RESULT_ERROR, getIntent().putExtra(VKSdk.EXTRA_ERROR_ID, error.registerObject()));
                } else {
                    setResult(VKSdk.RESULT_ERROR);
                }
                finish();
            }
        });
    }
}
 
开发者ID:DESTROYED,项目名称:The_busy_calendar,代码行数:34,代码来源:VKServiceActivity.java


示例19: call

import com.vk.sdk.api.VKError; //导入依赖的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


示例20: run

import com.vk.sdk.api.VKError; //导入依赖的package包/类
@Override
public void run() {
    if (mCheckUserInstallAnswer == CHECK_USER_INSTALL_ANSWER_VK
            || mCheckUserInstallAnswer == CHECK_USER_INSTALL_ANSWER_VK_FORCE) {
        for (final String receipt : purchases) {

            final String platform = "android";
            final int appId = getIntResByName(mAppCtx, VKSdk.SDK_APP_ID);
            final String deviceId = getDeviceId(mAppCtx);

            VKRequest request = new VKRequest(METHOD_NAME_SAVE_TRANSACTION);
            request.addExtraParameter(PLATFORM, platform);
            request.addExtraParameter(APP_ID, appId);
            if (!TextUtils.isEmpty(deviceId)) {
                request.addExtraParameter(DEVICE_ID, deviceId);
            }
            request.addExtraParameter(RECEIPT, receipt);

            request.executeSyncWithListener(new VKRequest.VKRequestListener() {
                @Override
                public void onComplete(VKResponse response) {
                    VKPaymentsDatabase.getInstance(mAppCtx).deletePurchase(receipt);
                    log("apps.saveTransaction successful response=" + response.json);
                }

                @Override
                public void onError(VKError error) {
                    log("apps.saveTransaction error=" + (error.apiError == null ? error.errorMessage : error.apiError.errorMessage));
                }
            });
        }
    }
}
 
开发者ID:marpies,项目名称:vk-ane,代码行数:34,代码来源:VKPaymentsServerSender.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AutocompletePrediction类代码示例发布时间:2022-05-21
下一篇:
Java Archive类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap