본문 바로가기

Flutter

app-ads.txt 파일 호스팅하기 (feat. firebase)

1. Windows에서 Flutter에 Firebase 추가하기를 참고해서 CLI 툴 설치

2. Firebase 콘솔에서 앱 선택 후 "Hosting" > 시작하기 클릭

3. public으로 호스팅할 폴더를 생성한다. (e.g. C:\Users\me\StudioProjects\public_for_hosting_ads )

4. CLI에서 해당 폴더로 이동 후 firebase init 수행

5. 프롬프트에 대해서 다음과 같이 선택

? Are you ready to proceed? Yes
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to
confirm your choices. Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

? Please select an option: Use an existing project
? Select a default Firebase project for this directory: babylingual-33707 (babylingual)
i  Using project babylingual-33707 (babylingual)

=== Hosting Setup

Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.

? What do you want to use as your public directory? public
? Configure as a single-page app (rewrite all urls to /index.html)? No
? Set up automatic builds and deploys with GitHub? No
+  Wrote public/404.html
+  Wrote public/index.html

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...
i  Writing gitignore file to .gitignore...

+  Firebase initialization complete!

 

6. public 폴더에 app-ads.txt 파일 생성

7. Google AdMob에서 모든 앱 > app-ads.txt > app-ads.txt 설정 방법 클릭

 

8. 파일 내용에 아래와 같은 모달에 제공된 코드를 붙여넣는다. 

9. cmd에서 다음 명령어 수행

`firebase deploy --only hosting`

 

10. 완료 후 CLI 툴에서 출력된 Hosting URL 접속해 확인

 

11. 구글 플레이 콘솔 > 앱 선택 > 사용자 늘리기 > 앱 정보 > 스토어 설정 > 스토어 등록정보 연락처 세부정보 > 웹사이트를 Hosting URL로 변경

 

12. Google AdMob에서 권장 조치 2. 업데이트 확인 버튼 클릭 시 성공