当前位置: 首页>>代码示例>>Java>>正文


Java TalkProtocol类代码示例

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


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

示例1: tryAuthorize

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
public boolean tryAuthorize(final AuthorizationCodeRequest request){
    Intent intent = TalkProtocol.createLoggedInActivityIntent(authorizer.getCallerActivity(), request.getAppKey(), request.getRedirectURI());

    if (intent == null) {
        return false;
    }

    try {
        authorizer.getStartActivityDelegate().startActivityForResult(intent, request.getRequestCode());
    } catch (ActivityNotFoundException e) {
        Logger.getInstance().i("LoggedInTalkAuthHandler is failed", e);
        return false;
    }

    return true;
}
 
开发者ID:yongbeam,项目名称:Android-kakaologin-gradle-sample,代码行数:17,代码来源:LoggedInTalkAuthHandler.java

示例2: tryAuthorize

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
public boolean tryAuthorize(AuthorizationCodeRequest request){
    Intent intent = TalkProtocol.createLoggedOutActivityIntent(authorizer.getCallerActivity(), request.getAppKey(), request.getRedirectURI());

    if (intent == null) {
        return false;
    }

    try {
        authorizer.getStartActivityDelegate().startActivityForResult(intent, request.getRequestCode());
    } catch (ActivityNotFoundException e) {
        Logger.getInstance().i("LoggedOutTalkAuthHandler is failed", e);
        return false;
    }

    return true;
}
 
开发者ID:yongbeam,项目名称:Android-kakaologin-gradle-sample,代码行数:17,代码来源:LoggedOutTalkAuthHandler.java

示例3: sendMessage

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
/**
 * 메시지 구성을 끝낸 후 카카오톡으로 메시지를 보낸다.
 * @param linkMessage 보낼 메시지를 구성하고 있는 contents
 * @param context 카카오톡을 실행시킬 context
 */
public void sendMessage(final String linkMessage, final Context context) throws KakaoParameterException {
    final Intent intent = TalkProtocol.createKakakoTalkLinkIntent(context, linkMessage);
    if (intent == null) {
        //alert install dialog
        new AlertDialog.Builder(context)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setMessage(context.getString(R.string.com_kakao_alert_install_kakaotalk))
            .setPositiveButton(android.R.string.ok, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(KakaoTalkLinkProtocol.TALK_MARKET_URL_PREFIX + makeReferrer())));
                }
            })
            .create().show();

    } else {
        context.startActivity(intent);
    }
}
 
开发者ID:yongbeam,项目名称:Android-kakaologin-gradle-sample,代码行数:25,代码来源:KakaoLink.java

示例4: getAuthTypes

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
private List<AuthType> getAuthTypes() {
    final List<AuthType> availableAuthTypes = new ArrayList<AuthType>();
    if(TalkProtocol.existCapriLoginActivityInTalk(getContext())){
        availableAuthTypes.add(AuthType.KAKAO_TALK);
    }
    if(StoryProtocol.existCapriLoginActivityInStory(getContext())){
        availableAuthTypes.add(AuthType.KAKAO_STORY);
    }
    availableAuthTypes.add(AuthType.KAKAO_ACCOUNT);

    final AuthType[] selectedAuthTypes = Session.getCurrentSession().getAuthTypes();
    availableAuthTypes.retainAll(Arrays.asList(selectedAuthTypes));

    // 개발자가 설정한 것과 available 한 타입이 없다면 직접계정 입력이 뜨도록 한다.
    if(availableAuthTypes.size() == 0){
        availableAuthTypes.add(AuthType.KAKAO_ACCOUNT);
    }
    return availableAuthTypes;
}
 
开发者ID:yongbeam,项目名称:Android-kakaologin-gradle-sample,代码行数:20,代码来源:LoginButton.java

示例5: getAuthTypes

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
/**
 * 카카오톡, 카카오스토리 등의 설치 유무를 체크하여 가능한 로그인 수단의 목록을 반환한다.
 * @return 카카오 로그인 수단 리스트 (AuthType)
 */
private static List<AuthType> getAuthTypes() {
    final List<AuthType> availableAuthTypes = new ArrayList<AuthType>();
    Activity activity = currentActivity.get();
    
    if (TalkProtocol.existCapriLoginActivityInTalk(activity)) {
        availableAuthTypes.add(AuthType.KAKAO_TALK);
    }
    if (StoryProtocol.existCapriLoginActivityInStory(activity)){
        availableAuthTypes.add(AuthType.KAKAO_STORY);
    }
    availableAuthTypes.add(AuthType.KAKAO_ACCOUNT);

    final AuthType[] selectedAuthTypes = Session.getCurrentSession().getAuthTypes();
    availableAuthTypes.retainAll(Arrays.asList(selectedAuthTypes));

    // 개발자가 설정한 것과 available 한 타입이 없다면 직접계정 입력이 뜨도록 한다.
    if(availableAuthTypes.size() == 0){
        availableAuthTypes.add(AuthType.KAKAO_ACCOUNT);
    }
    return availableAuthTypes;
}
 
开发者ID:haruio,项目名称:haru-sdk-android,代码行数:26,代码来源:KakaoLoginUtils.java

示例6: tryAuthorize

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
public boolean tryAuthorize(final AuthorizationCodeRequest request){
    Intent intent = TalkProtocol.createLoggedInActivityIntent(authorizer.getCallerActivity(), request);

    if (intent == null) {
        return false;
    }

    try {
        authorizer.getStartActivityDelegate().startActivityForResult(intent, request.getRequestCode());
    } catch (ActivityNotFoundException e) {
        Logger.getInstance().i("LoggedInTalkAuthHandler is failed", e);
        return false;
    }

    return true;
}
 
开发者ID:kkung,项目名称:kakao-android-sdk-standalone,代码行数:17,代码来源:LoggedInTalkAuthHandler.java

示例7: tryAuthorize

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
public boolean tryAuthorize(AuthorizationCodeRequest request){
    Intent intent = TalkProtocol.createLoggedOutActivityIntent(authorizer.getCallerActivity(), request);

    if (intent == null) {
        return false;
    }

    try {
        authorizer.getStartActivityDelegate().startActivityForResult(intent, request.getRequestCode());
    } catch (ActivityNotFoundException e) {
        Logger.getInstance().i("LoggedOutTalkAuthHandler is failed", e);
        return false;
    }

    return true;
}
 
开发者ID:kkung,项目名称:kakao-android-sdk-standalone,代码行数:17,代码来源:LoggedOutTalkAuthHandler.java

示例8: onActivityResult

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
public boolean onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    AuthorizationResult outcome;

    if (data == null) {
        // This happens if the user presses 'Back'.
        outcome = AuthorizationResult.createAuthCodeCancelResult("pressed back button or cancel button during requesting auth code.");
    } else if (TalkProtocol.isTalkProtocolMatched(data)) {
        outcome = AuthorizationResult.createAuthCodeErrorResult("TalkProtocol is mismatched during requesting auth code through KakaoTalk.");
    } else if (resultCode == Activity.RESULT_CANCELED) {
        outcome = AuthorizationResult.createAuthCodeCancelResult("pressed cancel button during requesting auth code.");
    } else if (resultCode != Activity.RESULT_OK) {
        outcome = AuthorizationResult.createAuthCodeErrorResult("got unexpected resultCode during requesting auth code. code=" + requestCode);
    } else {
        outcome = handleResultOk(data);
    }

    if(outcome.isPass())
        authorizer.tryNextHandler();
    else
        authorizer.completed(outcome);

    return true;
}
 
开发者ID:kkung,项目名称:kakao-android-sdk-standalone,代码行数:24,代码来源:AuthorizationCodeHandler.java

示例9: handleResultOk

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
private AuthorizationResult handleResultOk(final Intent data) {
    Bundle extras = data.getExtras();
    String errorType = extras.getString(TalkProtocol.EXTRA_ERROR_TYPE);
    String rediretURL = extras.getString(TalkProtocol.EXTRA_REDIRECT_URL);
    if (errorType == null && rediretURL != null) {
        return AuthorizationResult.createSuccessAuthCodeResult(rediretURL);
    } else {
        if(errorType != null && errorType.equals(TalkProtocol.NOT_SUPPORT_ERROR))
            return AuthorizationResult.createAuthCodePassResult();
        String errorDes = extras.getString(TalkProtocol.EXTRA_ERROR_DESCRIPTION);
        return AuthorizationResult.createAuthCodeErrorResult("redirectURL=" + rediretURL +", " + errorType + " : " + errorDes);
    }
}
 
开发者ID:yongbeam,项目名称:Android-kakaologin-gradle-sample,代码行数:14,代码来源:AuthorizationCodeHandler.java

示例10: sendMessage

import com.kakao.helper.TalkProtocol; //导入依赖的package包/类
/**
 * 메시지 구성을 끝낸 후 카카오톡으로 메시지를 보낸다.
 * @param linkMessage 보낼 메시지를 구성하고 있는 contents
 * @param callerActivity 카카오톡을 실행시킬 activity
 */
public void sendMessage(final String linkMessage, final Activity callerActivity) throws KakaoLinkParseException {
    final Intent intent = TalkProtocol.createKakakoTalkLinkIntent(context, linkMessage);
    if (intent == null) {
        throw new KakaoLinkParseException(context.getString(string.com_kakao_alert_install_kakaotalk));
    } else {
        callerActivity.startActivity(intent);
    }
}
 
开发者ID:kkung,项目名称:kakao-android-sdk-standalone,代码行数:14,代码来源:KakaoLink.java


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