codenameone / CodenameOne

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.
https://www.codenameone.com/
Other
1.71k stars 408 forks source link

Admob. Need to specify build hint for com.google.android.gms.ads.APPLICATION_ID #2978

Open pinktriangle opened 4 years ago

pinktriangle commented 4 years ago

Hi

Looking at adding google ad mob interstitial adverts into my app.

Full screen adverts appear in my app when I use their test id but do not work when I add my own ad mob id ca-app-pub-458796XXXXX/XXXXXXXXXX

I then came across the text below (https://developers.google.com/admob/android/quick-start?hl=en-GB#import_the_mobile_ads_sdk)

Which requires the android application id (in addition to the admob ad id) to be specified.

Important: This step is required as of Google Mobile Ads SDK version

17.0.0. Failure to add this tag results in a crash with the

message: The Google Mobile Ads SDK was initialized incorrectly.

Android manifest needs :

<meta-data 
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"
/>

which states as of version 17.0.0 I also need to specify

com.google.android.gms.ads.APPLICATION_ID with my own application Id.

Asked by support to raise this.

shannah commented 4 years ago

I've added this to the installation instructions in the cn1lib's readme https://github.com/shannah/admobfullscreen-codenameone/commit/40f7cb4cb75973615dd981d26e7a92261005c35e

Keeping this open as there may be something we can do to make this more automatic.