本文整理汇总了Java中com.vk.sdk.VKScope类的典型用法代码示例。如果您正苦于以下问题:Java VKScope类的具体用法?Java VKScope怎么用?Java VKScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VKScope类属于com.vk.sdk包,在下文中一共展示了VKScope类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onItemClick
import com.vk.sdk.VKScope; //导入依赖的package包/类
@Override
public void onItemClick(int position) {
ISocialType type = socialList.get(position);
analytic.reportEvent(Analytic.Interaction.CLICK_SIGN_IN_SOCIAL, type.getIdentifier());
if (type == SocialManager.SocialType.google) {
if (client == null) {
analytic.reportEvent(Analytic.Interaction.GOOGLE_SOCIAL_IS_NOT_ENABLED);
Toast.makeText(App.Companion.getAppContext(), R.string.google_services_late, Toast.LENGTH_SHORT).show();
} else {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(client);
activity.startActivityForResult(signInIntent, AppConstants.REQUEST_CODE_GOOGLE_SIGN_IN);
}
} else if (type == SocialManager.SocialType.facebook) {
List<String> permissions = new ArrayList<>();
permissions.add("email");
LoginManager.getInstance().logInWithReadPermissions(activity, permissions);
} else if (type == SocialManager.SocialType.vk) {
String[] scopes = {VKScope.EMAIL};
VKSdk.login(activity, scopes);
} else {
api.loginWithSocial(activity, type);
}
}
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:24,代码来源:SocialAuthAdapter.java
示例2: toJSON
import com.vk.sdk.VKScope; //导入依赖的package包/类
public static String toJSON( VKAccessToken token ) {
if( token.userId == null ) return null;
JSONObject json = new JSONObject();
addValueForKey( token.userId, "userId", json );
addValueForKey( token.accessToken, "accessToken", json );
addValueForKey( token.secret, "secret", json );
addValueForKey( token.email, "email", json );
addValueForKey( token.expiresIn, "expiresIn", json );
addValueForKey( token.created, "created", json );
addValueForKey( token.httpsRequired, "httpsRequired", json );
/* Loop through all permissions and see which one are part of this token */
List<String> allPermissions = VKScope.parseVkPermissionsFromInteger( Integer.MAX_VALUE ); // Get all permissions
JSONArray activePermissions = new JSONArray();
/* VKAcessToken's scope may be null, however, it's not
* accessible directly so we have to wrap it in try-catch block */
try {
for( String permission : allPermissions ) {
if( token.hasScope( permission ) ) {
activePermissions.put( permission );
}
}
} catch( Exception e ) {
// VKAccessToken's 'scope' is null, thus no permissions
}
addValueForKey( activePermissions.toString(), "permissions", json );
return json.toString();
}
开发者ID:marpies,项目名称:vk-ane,代码行数:29,代码来源:VKAccessTokenUtils.java
示例3: shareOrLogin
import com.vk.sdk.VKScope; //导入依赖的package包/类
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;
}
开发者ID:DrMoriarty,项目名称:cordova-social-vk,代码行数:15,代码来源:SocialVk.java
示例4: login
import com.vk.sdk.VKScope; //导入依赖的package包/类
@Override
public void login() {
VKSdk.login(getActivity(), VKScope.EMAIL);
}
开发者ID:NaikSoftware,项目名称:NaikSoftware-Lib-Android,代码行数:5,代码来源:VkAuthProvider.java
注:本文中的com.vk.sdk.VKScope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论