
언어 🇰🇷 한국어
문서
시작하기
사용법
인증
구성
Android 앱에 댓글 추가하기
이것은 FastComments의 공식 Android 라이브러리입니다.
Android용 FastComments 댓글 위젯
저장소
AI 코딩 에이전트 
코딩 에이전트에 FastComments 컨텍스트를 제공하세요 - 위젯, 구성, Secure SSO, REST API 및 SDKs:
npx skills add fastcomments/skills
Claude Code, Codex, Cursor, Copilot, Gemini 및 모든 다른 에이전트와 함께 작동하며, skills CLI 가 지원합니다.
기능 
- 🔄 실시간 업데이트가 가능한 라이브 댓글
- 📱 네이티브 안드로이드 UI 컴포넌트
- 🧵 답글이 달린 스레드형 토론
- 👤 안전한 SSO 인증
- 👍 스타일을 커스터마이즈할 수 있는 투표 시스템
- 📊 실시간 결과가 표시되는 댓글 내 투표
- 🔔 사용자 알림 및 접속 상태
- 🔍 댓글 검토(모더레이션) 기능
- 📱 소셜 피드 통합
- ♾️ 무한 스크롤 페이지네이션
- 🎨 포괄적인 테마 설정
설치 
앱의 build.gradle.kts 파일에 FastComments SDK를 추가하세요:
dependencies {
implementation("com.fastcomments:android-sdk:2.1.0")
}
프로젝트의 settings.gradle.kts에 Repsy 저장소가 있는지 확인하세요:
dependencyResolutionManagement {
repositories {
maven {
url = uri("https://repo.repsy.io/mvn/winrid/fastcomments")
}
// 기타 저장소...
}
}
기본 사용법 
1. 레이아웃에 FastCommentsView 추가
<com.fastcomments.sdk.FastCommentsView
android:id="@+id/commentsView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
2. SDK 초기화 및 구성
// SDK 구성
val config = CommentWidgetConfig(
"your-tenant-id",
"page-url-id",
"Page Title",
"yourdomain.com",
"Site Name"
)
// 추가 구성 옵션
config.voteStyle = VoteStyle.UpDown // 또는 VoteStyle.Heart
config.enableInfiniteScrolling = true
config.hasDarkBackground = true // 다크 모드 지원용
// SDK 초기화
val sdk = FastCommentsSDK(config)
// 레이아웃에서 댓글 뷰 찾기
val commentsView = findViewById<FastCommentsView>(R.id.commentsView)
// 뷰에 SDK 인스턴스 설정
commentsView.setSDK(sdk)
// 댓글 로드
commentsView.load()
보안 SSO 인증 
사용자에 대한 보안 인증을 구현하세요:
// 사용자 데이터 생성(권장: 서버 측에서)
val userData = SecureSSOUserData(
"user-id",
"user@example.com",
"User Name",
"https://path-to-avatar.jpg"
)
// SSO 토큰 생성(서버에서 수행해야 합니다!)
val sso = FastCommentsSSO.createSecure("YOUR_API_KEY", userData)
val token = sso.prepareToSend()
// 구성에 추가
config.sso = token
피드 통합 
댓글이 포함된 소셜 미디어 스타일 피드 표시:
// SDK 구성
CommentWidgetConfig config = new CommentWidgetConfig();
config.tenantId = "your-tenant-id";
config.urlId = "page-url-id";
// 피드 SDK 초기화
FastCommentsFeedSDK feedSDK = new FastCommentsFeedSDK(config);
// 피드 뷰 설정
FastCommentsFeedView feedView = findViewById(R.id.feedView);
feedView.setSDK(feedSDK);
// 상호작용 리스너 설정
feedView.setFeedViewInteractionListener(new FastCommentsFeedView.OnFeedViewInteractionListener() {
@Override
public void onFeedLoaded(List<FeedPost> posts) {
// 피드 로드 성공
}
@Override
public void onFeedError(String errorMessage) {
// 오류 처리
}
@Override
public void onPostSelected(FeedPost post) {
// 사용자가 게시물을 선택함
}
@Override
public void onCommentsRequested(FeedPost post) {
// 게시물의 댓글 표시
CommentsDialog dialog = new CommentsDialog(context, post, feedSDK);
dialog.show();
}
});
// Load the feed
feedView.load();
라이브 채팅 통합 
앱에 실시간 채팅 인터페이스를 추가하세요:
// 레이아웃 XML에 LiveChatView 추가
// <com.fastcomments.sdk.LiveChatView
// android:id="@+id/liveChatView"
// android:layout_width="match_parent"
// android:layout_height="match_parent" />
// Create a configuration for the SDK
val config = CommentWidgetConfig().apply {
tenantId = "your-tenant-id"
urlId = "chat-room-identifier"
pageTitle = "Chat Room Name"
}
LiveChatView.setupLiveChatConfig(config)
// 선택 사항: 사용자 인증 추가
val userData = SimpleSSOUserData(
"User Name",
"user@example.com",
"https://path-to-avatar.jpg"
)
val sso = FastCommentsSSO(userData)
config.sso = sso.prepareToSend()
// SDK 초기화
val sdk = FastCommentsSDK().configure(config)
// 라이브 채팅 뷰 설정
val liveChatView = findViewById<LiveChatView>(R.id.liveChatView)
liveChatView.setSDK(sdk)
liveChatView.load()
// 라이프사이클 처리를 잊지 마세요
override fun onResume() {
super.onResume()
sdk.refreshLiveEvents()
}
override fun onDestroy() {
super.onDestroy()
sdk.cleanup()
}
구성 옵션 
SDK는 CommentWidgetConfig 클래스를 통해 다양한 구성 옵션을 제공합니다:
| 옵션 | 설명 |
|---|---|
tenantId | FastComments 계정 ID |
urlId | 현재 페이지를 나타내는 ID |
sso | 인증용 SSO 토큰 |
allowAnon | 익명 댓글 작성 허용 |
voteStyle | UpDown 또는 Heart 투표 스타일 |
hideAvatars | 사용자 아바타 숨기기 |
hasDarkBackground | 다크 모드 여부 표시 |
customCSS | 사용자 정의 CSS 스타일 |
enableInfiniteScrolling | 무한 스크롤 페이지네이션 활성화 |
readonly | 댓글 작성은 비활성화하되 댓글은 표시 |
disableVoting | 투표 기능 비활성화 |
disableLiveCommenting | 실시간 업데이트 비활성화 |
pollCreation | 댓글에 투표를 첨부할 수 있는 대상: NUMBER_0 비활성화, NUMBER_1 관리자 및 중재자, NUMBER_2 모든 사용자 |
pollVoting | 투표에 참여할 수 있는 대상: NUMBER_0 로그인한 사용자, NUMBER_1 모든 사용자 |
설문조사 
투표(Polls)는 웹 위젯과 동일하게 작동하며, FastComments 대시보드의 동일한 위젯 설정(또는 위의 pollCreation / pollVoting)에서 켤 수 있습니다.
- 투표가 포함된 댓글은 텍스트 아래에 투표를 표시합니다. 독자는 옵션을 탭하여 투표할 수 있고, 투표 전에 결과를 보이거나 숨길 수 있으며, 투표를 변경할 수도 있습니다. 다른 사람들이 투표하면 집계가 실시간으로 업데이트됩니다.
- 투표는 특정 날짜에 마감되거나, 투표할 때까지 결과를 숨기거나, 투표자를 관리자에게만 또는 모든 사람에게 보이게 할 수 있습니다("투표자 보기").
- 조회자가 투표를 만들 수 있는 경우,
FastCommentsView의 댓글 입력창에 투표 빌더를 여는 투표 버튼이 표시됩니다. 툴바를 켠 적이 없더라도 이를 위한 툴바 행이 나타납니다.sdk.setCommentToolbarEnabled(false)를 호출하면 투표 버튼을 포함해 툴바가 숨겨지고, 입력창의setPollCreationEnabled(false)는 투표 버튼만 제거합니다. 입력창이 SDK를 받을 때 이 설정을 읽어들이므로FastCommentsView를 생성하기 전에setCommentToolbarEnabled를 호출하세요. 이미 화면에 있는 뷰의 경우 대신getBottomCommentInput().setToolbarVisible(false)를 호출하세요. 라이브 채팅 입력창은 웹 라이브 채팅과 마찬가지로 이 버튼을 표시하지 않습니다.
자체 UI에서 투표를 게시하려면 CommentPollInput을 postComment에 전달하세요:
CommentPollInput poll = new CommentPollInput()
.question("Where should we eat?")
.options(Arrays.asList("Tacos", "Ramen"))
// 선택 사항: ISO 8601 마감 날짜, PollPrivacy 값, 투표할 때까지 결과 숨기기.
.closesAt(Instant.now().plus(1, ChronoUnit.DAYS).toString())
.privacy(PollPrivacy.NUMBER_2.getValue())
.requireVoteToSeeResults(true);
sdk.postComment("Lunch vote", null, null, poll, callback);
sdk.votePoll(commentId, optionId, callback)과 sdk.getPollVoters(commentId, page, search, callback)가 투표 및 투표자 목록 기능을 담당합니다. 투표 색상은 THEMING.md에 나열되어 있습니다.
포괄적인 테마 사용자 지정 
FastComments SDK의 모든 버튼 및 UI 요소는 테마 설정이 가능합니다. 앱 브랜딩을 완전히 제어하려면 FastCommentsTheme.Builder를 사용하세요.
프로그래밍 방식 테마 적용 (권장)
val theme = FastCommentsTheme.Builder()
// 작업 버튼: 전송, 투표, 메뉴, 좋아요/공유 버튼
.setActionButtonColor(Color.parseColor("#FF1976D2"))
// 답글 버튼: 댓글 답글 버튼
.setReplyButtonColor(Color.parseColor("#FF4CAF50"))
// 토글 버튼: 답글 표시/숨기기 버튼
.setToggleRepliesButtonColor(Color.parseColor("#FFFF5722"))
// 더 보기 버튼: 페이지 매김 버튼
.setLoadMoreButtonTextColor(Color.parseColor("#FF9C27B0"))
.setPrimaryColor(Color.parseColor("#FF6200EE"))
.setLinkColor(Color.parseColor("#FF1976D2"))
.setDialogHeaderBackgroundColor(Color.parseColor("#FF333333"))
.build()
// 테마 적용
sdk.setTheme(theme)
빠른 색상 재정의
간단한 브랜딩을 위해 colors.xml의 색상 리소스를 오버라이드하세요:
<!-- 앱의 res/values/colors.xml에서 -->
<resources>
<!-- 모든 주요 UI 요소 변경 -->
<color name="primary">#FF1976D2</color>
<!-- 또는 특정 버튼 유형을 사용자화 -->
<color name="fastcomments_action_button_color">#FF1976D2</color>
<color name="fastcomments_reply_button_color">#FF4CAF50</color>
<color name="fastcomments_toggle_replies_button_color">#FFFF5722</color>
<color name="fastcomments_load_more_button_text_color">#FF9C27B0</color>
</resources>
테마 적용 버튼 범위
SDK의 모든 버튼은 테마를 지원합니다:
- 전송 버튼, 투표 버튼, 메뉴 버튼, 답글 버튼
- 답글 표시/숨기기 버튼, 더 보기 버튼
- 피드 액션 버튼(좋아요, 댓글, 공유)
- 다이얼로그 버튼(제출, 취소, 저장)
- 피드 게시물의 동적 작업 버튼
자세한 테마 문서는 THEMING.md를 참조하세요.
메모리 관리 
메모리 누수 방지
Activity 또는 Fragment에서 FastComments 뷰를 사용할 때 메모리 누수를 방지하려면, 더 이상 뷰가 필요하지 않을 때 항상 cleanup()을 호출하세요:
액티비티에서:
@Override
protected void onDestroy() {
super.onDestroy();
// 메모리 누수를 방지하기 위해 FastComments 뷰를 정리합니다
if (feedView != null) {
feedView.cleanup();
}
if (commentsView != null) {
commentsView.cleanup();
}
}
프래그먼트에서:
@Override
public void onDestroyView() {
super.onDestroyView();
// 프래그먼트 뷰가 파괴될 때 FastComments 뷰를 정리합니다
if (feedView != null) {
feedView.cleanup();
feedView = null;
}
}
@Override
public void onDestroy() {
super.onDestroy();
// 프래그먼트가 파괴될 때 추가 정리 수행
if (feedSDK != null) {
feedSDK.cleanup();
feedSDK = null;
}
}
프래그먼트를 전환할 때:
// FastComments 뷰를 포함한 프래그먼트를 교체 또는 제거하기 전에
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.container);
if (currentFragment instanceof YourFragmentWithFeedView) {
((YourFragmentWithFeedView) currentFragment).cleanupFeedView();
}
// Then proceed with fragment transaction
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, newFragment)
.commit();
중요: 메모리 누수를 방지하려면 항상 cleanup() 메서드를 호출하세요. 특히 다음과 같은 경우:
- 액티비티가 종료될 때
- 프래그먼트 뷰가 파괴될 때
- 프래그먼트 간 전환 시
- FastComments 컴포넌트를 포함한 화면에서 이동할 때
도움을 원하시나요?
Android 라이브러리와 관련하여 문제가 발생하거나 질문이 있는 경우, 다음을 이용하세요:
기여
기여는 환영합니다! 기여 지침은 GitHub 저장소에서 확인하세요.