本文整理汇总了Java中com.vk.sdk.VKSdk.wakeUpSession方法的典型用法代码示例。如果您正苦于以下问题:Java VKSdk.wakeUpSession方法的具体用法?Java VKSdk.wakeUpSession怎么用?Java VKSdk.wakeUpSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vk.sdk.VKSdk
的用法示例。
在下文中一共展示了VKSdk.wakeUpSession方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shareVK
import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
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);
}
示例2: onCreate
import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
VKUIHelper.onCreate(this);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
setContentView(R.layout.activity_main);
app_bar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(app_bar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
drawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
drawerFragment.init((DrawerLayout) findViewById(R.id.drawer_layout), this, app_bar);
// VK INITIALIZATION
VKSdk.initialize(listener, Config.APP_ID, null);
// VK Authorize User
if(VKSdk.wakeUpSession() && user.authed()){
}else{
selectSection(-1);
}
}
示例3: onResume
import com.vk.sdk.VKSdk; //导入方法依赖的package包/类
@Override
public void onResume() {
super.onResume();
if (VKSdk.isLoggedIn() || VKSdk.wakeUpSession())
update(isNeedUpdate());
else
VKSdk.authorize(NavigationActivity.vkScope, true, false);
}
示例4: call
import com.vk.sdk.VKSdk; //导入方法依赖的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;
}
示例5: onCreate
import com.vk.sdk.VKSdk; //导入方法依赖的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);
}
});
}
示例6: onCreate
import com.vk.sdk.VKSdk; //导入方法依赖的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]);
}