AI 리워드 브라우저 API v1
API Reference Document
API v1 안내
- AI 리워드 브라우저와 연동을 위한 서비스 호출 규약 명세입니다.
- 서비스를 이용하기 위해서는 제휴가 필요하며, 서비스ID를 제공 받아 리워드 서비스에 연동이 가능합니다.
- 제공하는 모든 서비스 연동에서는 개인정보 등을 전송할 수 없습니다.
개발 공통
Android 11(API 30) 이에서 앱을 패키지 명으로 직접 호출하려면 호출하는 앱의 AndroidManifest.xml에 <queries> 태그를 추가해야 할 수도 있습니다
<queries> <package android:name="com.aibrowser.app" /> </queries>JAVA (Android Native)
import android.content.ComponentName; import android.content.Intent; Intent intent = new Intent(); intent.setComponent(new ComponentName("com.aibrowser.app", "com.aibrowser.app.main")); intent.putExtra("SID", "서비스ID"); intent.putExtra("CID", "캠페인ID"); intent.setAction(Intent.ACTION_MAIN); try { startActivity(intent); } catch (Exception e) { // 앱이 설치되어 있지 않거나 경로가 잘못된 경우 예외 처리 e.printStackTrace(); }Kotlin (Android Native)
import android.content.ComponentName import android.content.Intent val intent = Intent(Intent.ACTION_MAIN).apply { component = ComponentName("com.aibrowser.app", "com.aibrowser.app.main") putExtra("SID", "서비스ID") putExtra("CID", "캠페인ID") } try { startActivity(intent) } catch (e: Exception) { e.printStackTrace() }Flutter (MethodChannel)
Flutter Dart 코드
import 'package:flutter/services.dart'; static const platform = MethodChannel('com.example.app/launcher'); FuturelaunchAiBrowser() async { try { await platform.invokeMethod('launchBrowser', { "sid": "서비스ID", "cid": "캠페인ID" }); } on PlatformException catch (e) { print("Failed to launch: ${e.message}"); } } Flutter Kotlin 코드 (MainActivity.kt Side)
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.engine.FlutterEngine import io.flutter.plugin.common.MethodChannel import android.content.ComponentName import android.content.Intent class MainActivity: FlutterActivity() { private val CHANNEL = "com.example.app/launcher" override fun configureFlutterEngine(flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result -> if (call.method == "launchBrowser") { val sid = call.argument("sid") val cid = call.argument ("cid") val intent = Intent(Intent.ACTION_MAIN).apply { component = ComponentName("com.aibrowser.app", "com.aibrowser.app.main") putExtra("SID", sid) putExtra("CID", cid) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) // 서비스나 백그라운드 호출 대비 } try { startActivity(intent) result.success(true) } catch (e: Exception) { result.error("UNAVAILABLE", "App not installed", null) } } else { result.notImplemented() } } } } Web Link (intent link)
Intent Code #1 *추천 방식*
intent://start#Intent;scheme=aibrowser;package=com.aibrowser.app;S.SID=서비스ID;S.CID=캠페인ID;S.browser_fallback_url=https://play.google.com/store/apps/details?id=com.aibrowser.app;endIntent Code #2
intent:#Intent;action=android.intent.action.MAIN;package=com.aibrowser.app;component=com.aibrowser.app/.main;S.SID=서비스ID;S.CID=캠페인ID;S.browser_fallback_url=https://play.google.com/store/apps/details?id=com.aibrowser.app;end
