當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。