퀴즈

퀴즈는 사용자가 간단한 질문에 답하고 포인트를 받을 수 있는 기능입니다. 오퍼월과 함께 사용하면 참여율이 높아집니다.

퀴즈 목록 조회

현재 진행 중인 퀴즈 목록을 가져옵니다:

Android:

AdchainSdk.getQuizzes(
    callback = object : AdchainQuizCallback {
        override fun onSuccess(quizzes: List<AdchainQuiz>) {
            // 퀴즈 목록을 받았을 때
            quizzes.forEach { quiz ->
                println("퀴즈: ${quiz.title}")
                println("보상: ${quiz.reward}P")
            }
        }

        override fun onFailure(error: AdchainError) {
            println("퀴즈 조회 실패: ${error.message}")
        }
    }
)

iOS:

AdchainSdk.shared.getQuizzes { result in
    switch result {
    case .success(let quizzes):
        for quiz in quizzes {
            print("퀴즈: \(quiz.title)")
            print("보상: \(quiz.point)P")
        }
    case .failure(let error):
        print("퀴즈 조회 실패: \(error.localizedDescription)")
    }
}

React Native:

try {
  const quizzes = await AdchainSdk.getQuizzes();
  quizzes.forEach(quiz => {
    console.log(`퀴즈: ${quiz.title}`);
    console.log(`보상: ${quiz.point}P`);
  });
} catch (error) {
  console.error('퀴즈 조회 실패:', error);
}

퀴즈 데이터 구조

{
  id: string;           // 퀴즈 ID
  title: string;        // 퀴즈 제목
  description: string;  // 설명
  point: number;       // 보상 포인트
  imageUrl: string;     // 썸네일 이미지
  landingUrl: string;   // 접근 url (easy, medium, hard)
  metadata: {
    category: string; // Quiz, Survey
  }
}

UI에 표시하기

퀴즈는 보통 오퍼월 상단에 카드 형태로 표시하면 좋습니다:

// Android RecyclerView 예시
class QuizAdapter(private val quizzes: List<AdchainQuiz>) : RecyclerView.Adapter<QuizViewHolder>() {
    override fun onBindViewHolder(holder: QuizViewHolder, position: Int) {
        val quiz = quizzes[position]
        holder.titleText.text = quiz.title
        holder.rewardText.text = "${quiz.point}P"
        Glide.with(holder.itemView)
            .load(quiz.imageUrl)
            .into(holder.imageView)

        holder.itemView.setOnClickListener {
            // 퀴즈 화면으로 이동
            openQuiz(quiz)
        }
    }
}

퀴즈 참여하기

퀴즈 참여는 오퍼월 안에서 자동으로 처리됩니다. 별도 API가 필요없습니다.

사용자가 퀴즈를 완료하면 SDK가 자동으로:

  1. 포인트 지급

  2. quiz_completed 이벤트 전송

  3. 대시보드 통계 업데이트

완료된 퀴즈 필터링

이미 완료한 퀴즈는 표시하지 않으려면:

val availableQuizzes = quizzes.filter { it.status == "available" }

주의사항

  • 퀴즈는 하루에 한 번씩 갱신됩니다

  • 사용자가 로그인되어 있어야 조회 가능

  • 네트워크가 필요합니다

다음 단계

Last updated