How to create admob app-ads.txt file flutter web app?
441
I also recently tried flutter web. I went on a "fishing expedition", and managed to solve this issue.
What i did:
- Place your
app-ads.txt
in<project>/web
folder. - Run
flutter build web
- Check that
app-ads.txt
appeared inbuild/web
folder. - Check that in
build/web/flutter_service_worker.js
inRESOURCES
map appeared a record with key"app-ads.txt"
(ex."app-ads.txt": "4c75380ac52243715a448e96239e0ca5",
) - Run
firebase deploy --only hosting
After this, app-ads.txt
should be available on https://your-domain.web.app/app-ads.txt
, https://your-domain.firebaseapp.com/app-ads.txt
and(if you added a custom domain) on https://my-custom-domain.com/app-ads.txt
.
P.S. If you got redirected from /app-ads.txt
to your main page, then try to clear your site cache:
- Press F12
- Open "Application" tab
- Choose "Storage"
- Press "Clear site data"
After this, app-ads.txt
should be available.
Author by
Samiul Alim
Updated on January 01, 2023Comments
-
Samiul Alim over 1 year
I have a website made with flutter web. My app which shows google admob ad. Now google admob told me to create an app-ads.txt file on my website . Flutter web is a single page website so, is it possible to create an app-ads.txt file with my flutter web app !?
-
Admin over 2 yearsPlease clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
-
-
Beginner_ over 2 yearsEven if I try
$ flutter build web
, app-ads.txt are not appeared inbuild/web
. I checked thatapp-ads.txt
was inProjectDir/web
. -
Beginner_ over 2 yearsI could solve it↑. I added
<meta http-equiv="refresh" content="app-ads.txt">
between<html><head></head></html>
inProjectDir/web/index.html