'Do I need to keep AdMob ad unit IDs in a safe place?
I wanted to ask where should I keep my AdMob ad unit IDs? Is it wrong to keep it in the strings.xml inside my Android Project? And what happens if someone gets my ad unit IDs?
Solution 1:[1]
You can keep ad unit ID in string.xml or in activity same results, but if someone get your ad unit ID he may do sabotage
Here more details from admob about sabotage and how to prevent it
https://support.google.com/admob/answer/7062933
......
Also they suggest to make Authorized Sellers for Apps (app-ads.txt)
standard, originally designed for protecting web ad inventory. It extends compatibility to support ads shown in mobile apps.
Use of app-ads.txt is not mandatory, but is highly recommended, especially if you are concerned that others may be spoofing your app.
You need to create website (domain) and create txt file name it "app-ads.txt" place it in root...
put inside it google.com, pub-xxxxxxxxxxxxx, DIRECT, f088c47fec942fa0
pub-xxxxxxxxxxxxx change this with yours..
in app listing in store add link of your website
here more details
Solution 2:[2]
Place your ad unite in gridle file like this
`resValue 'string', 'app_id', '"ca-app-pub-3940256099942544~3347511713"'
and get like that
getString(R.string.app_id)`
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dreamer |
Solution 2 |