To obtain AAID it is obligatory to add
implementation "com.google.android.gms:play-services-ads:x.y.z"
dependency to dependencies
function in gradle file, then implement what's described How to get Advertising ID in android programmatically
But from 17.0.0 version of play-services-ads
, according to https://developers.google.com/admob/android/rel-notes#17.0.0 AdMob App ID
is required in AndroidManifest.xml
. Crash otherwise.
<manifest>
<application>
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
</manifest>
source: https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml
It's strange to me. I don't use AdMob, so I don't want to write messy code in AndroidManifest.xml
. It looks like this is the way for Google to subtly force usage of AdMob for greenfield projects.
Which dependency is optimal for getting AAID nowadays?