plugins icon indicating copy to clipboard operation
plugins copied to clipboard

admob and vanilla js for Android

Open germandeburzaco opened this issue 7 months ago • 1 comments

I've been trying to add ADMOB to a test app for several days without success. Steps I've taken:

  1. Add "@nativescript/google-mobile-ads": "^5.0.3"

  2. In AndroidManifest.xml (./App_Resources/Android/src/main) add

<application..> ...
<meta-data  
android:name="com.google.android.gms.ads.APPLICATION_ID"   
android:value="ca-app-pub-3940256099942544~3347511713" />
...
</application>
  1. in the app.js add
import { Application } from '@nativescript/core';
import { MobileAds } from '@nativescript/google-mobile-ads';

console.log("🔥 Inicializando Google Mobile Ads...");
MobileAds.init();

Application.run({ moduleName: 'main-page' });

Then "ns run android"

So far, I haven't been able to get it working.

Other data: ns --version 8.9.2 windows 10 and vscode Mi repo https://github.com/germandeburzaco/testMonetizarApp

germandeburzaco avatar May 31 '25 00:05 germandeburzaco

Any errors ?

triniwiz avatar Jun 19 '25 23:06 triniwiz