Skip to content

admob and vanilla js for Android #631

@germandeburzaco

Description

@germandeburzaco

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions