Java Code Examples for com.vk.sdk.VKSdk#isLoggedIn()
The following examples show how to use
com.vk.sdk.VKSdk#isLoggedIn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NavigationDrawerFragment.java From IdealMedia with Apache License 2.0 | 6 votes |
private void shareVK() { if (VKSdk.isLoggedIn() || VKSdk.wakeUpSession()) { new VKShareDialog() .setText(getString(R.string.like_text)) .setAttachmentLink(getString(R.string.like_url_title), getString(R.string.like_url)) .setShareDialogListener(new VKShareDialog.VKShareDialogListener() { @Override public void onVkShareComplete(int i) { showThankYouToast(); ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER) .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("VK").setLabel("OK").build()); } @Override public void onVkShareCancel() { ((NavigationActivity)getActivity()).getTracker(NavigationActivity.TrackerName.APP_TRACKER) .send(new HitBuilders.EventBuilder().setCategory("Sharing").setAction("VK").setLabel("Cancel").build()); } }) .show(getFragmentManager(), "SHARE"); } else VKSdk.authorize(NavigationActivity.vkScope, true, false); }
Example 2
Source File: LoginMaster.java From uPods-android with Apache License 2.0 | 6 votes |
public void logout() { if (AccessToken.getCurrentAccessToken() != null) { LoginManager.getInstance().logOut(); Logger.printInfo(LOG_TAG, "Loged out from facebook"); } if (Twitter.getSessionManager().getActiveSession() != null) { Twitter.getSessionManager().clearActiveSession(); Twitter.logOut(); Logger.printInfo(LOG_TAG, "Loged out from twitter"); } if (VKSdk.isLoggedIn()) { VKSdk.logout(); Logger.printInfo(LOG_TAG, "Loged out from vk"); } Prefs.remove(SyncMaster.GLOBAL_TOKEN); userProfile = new UserProfile(); }
Example 3
Source File: LoginMaster.java From uPods-android with Apache License 2.0 | 6 votes |
public void initUserProfile(final IOperationFinishWithDataCallback profileFetched, boolean isForceUpdate) { if (userProfile != null && !isForceUpdate) { profileFetched.operationFinished(userProfile); } else if (!isLogedIn()) { userProfile = new UserProfile(); profileFetched.operationFinished(userProfile); } else { if (AccessToken.getCurrentAccessToken() != null) { fetchFacebookUserData(profileFetched); } else if (Twitter.getSessionManager().getActiveSession() != null) { fetchTwitterUserData(profileFetched); } else if (VKSdk.isLoggedIn()) { fetchVkUserData(profileFetched); } } }
Example 4
Source File: VKAudioFragment.java From IdealMedia with Apache License 2.0 | 5 votes |
@Override public void onResume() { super.onResume(); if (VKSdk.isLoggedIn() || VKSdk.wakeUpSession()) update(isNeedUpdate()); else VKSdk.authorize(NavigationActivity.vkScope, true, false); }
Example 5
Source File: LoginActivity.java From vk_music_android with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (VKSdk.isLoggedIn()) { createUserComponentAndLaunchMainActivity(); return; } setTitle(R.string.log_in); ActivityLoginBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_login); binding.login.setOnClickListener(v -> VKSdk.login(LoginActivity.this, "audio", "offline")); }
Example 6
Source File: SocialVk.java From cordova-social-vk with Apache License 2.0 | 5 votes |
private boolean shareOrLogin(final String url, final String comment, final String imageUrl) { this.cordova.setActivityResultCallback(this); final String[] scope = new String[]{VKScope.WALL, VKScope.PHOTOS}; if(!VKSdk.isLoggedIn()) { savedUrl = url; savedComment = comment; savedImageUrl = imageUrl; VKSdk.login(getActivity(), scope); } else { share(url, comment, imageUrl); } return true; }
Example 7
Source File: LoginMaster.java From uPods-android with Apache License 2.0 | 4 votes |
public boolean isLogedIn() { return AccessToken.getCurrentAccessToken() != null || Twitter.getSessionManager().getActiveSession() != null || VKSdk.isLoggedIn(); }