This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +26
-11
lines changed Expand file tree Collapse file tree 5 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -411,7 +411,8 @@ export class HelloWorldModel extends Observable {
411411 iosTestDeviceIds : [
412412 "45d77bf513dfabc2949ba053da83c0c7b7e87715" , // Eddy's iPhone 6s
413413 "fee4cf319a242eab4701543e4c16db89c722731f" // Eddy's iPad Pro
414- ]
414+ ] ,
415+ keywords : [ "keyword1" , "keyword2" ] // add keywords for ad targeting
415416 } ) . then (
416417 ( ) => {
417418 alert ( {
Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ Go [manage your AdMob app](https://apps.admob.com/#account/appmgmt:) and grab th
4242 iosTestDeviceIds: [ // Android automatically adds the connected device as test device with testing:true, iOS does not
4343 " 45d77bf513dfabc2949ba053da83c0c7b7e87715" , // Eddy's iPhone 6s
4444 " fee4cf319a242eab4701543e4c16db89c722731f" // Eddy's iPad Pro
45- ]
45+ ],
46+ keywords: [" keyword1" , " keyword2" ] // add keywords for ad targeting
4647 }).then (
4748 function () {
4849 console .log (" AdMob banner showing" );
@@ -108,4 +109,4 @@ There's currently no functional difference between the AdMob features in the Fir
108109[ nativescript-admob] ( https://github.com/EddyVerbruggen/nativescript-admob ) .
109110
110111The main advantage of using the version in the Firebase plugin is to avoid a gradle build conflict
111- in the Android build you may encounter when including both plugins in your app.
112+ in the Android build you may encounter when including both plugins in your app.
Original file line number Diff line number Diff line change @@ -768,6 +768,13 @@ firebase.admob._buildAdRequest = settings => {
768768 builder . addTestDevice ( deviceId ) ;
769769 }
770770 }
771+
772+ if ( settings . keywords !== undefined && settings . keywords . length > 0 ) {
773+ for ( let i = 0 ; i < settings . keywords . length ; i ++ ) {
774+ builder . addKeyword ( settings . keywords [ i ] ) ;
775+ }
776+ }
777+
771778 const bundle = new android . os . Bundle ( ) ;
772779 bundle . putInt ( "nativescript" , 1 ) ;
773780 const adextras = new com . google . android . gms . ads . mediation . admob . AdMobExtras ( bundle ) ;
@@ -1987,15 +1994,11 @@ firebase.downloadFile = arg => {
19871994 const storageReference = storageRef . child ( arg . remoteFullPath ) ;
19881995
19891996 const onSuccessListener = new com . google . android . gms . tasks . OnSuccessListener ( {
1990- onSuccess : downloadTaskSnapshot => {
1991- resolve ( ) ;
1992- }
1997+ onSuccess : downloadTaskSnapshot => resolve ( )
19931998 } ) ;
19941999
19952000 const onFailureListener = new com . google . android . gms . tasks . OnFailureListener ( {
1996- onFailure : exception => {
1997- reject ( "Download failed. " + exception ) ;
1998- }
2001+ onFailure : exception => reject ( "Download failed. " + exception )
19992002 } ) ;
20002003
20012004 let localFilePath ;
Original file line number Diff line number Diff line change @@ -633,6 +633,11 @@ export namespace admob {
633633 */
634634 bottom ?: number ;
635635 } ;
636+
637+ /**
638+ * Specify keywords for ad targeting
639+ */
640+ keywords ?: string [ ] ;
636641 }
637642
638643 export interface ShowInterstitialOptions {
@@ -710,7 +715,7 @@ export namespace analytics {
710715 function logEvent ( options : LogEventOptions ) : Promise < any > ;
711716
712717 function setUserId ( options : SetUserIdOptions ) : Promise < any > ;
713-
718+
714719 function setUserProperty ( options : SetUserPropertyOptions ) : Promise < any > ;
715720
716721 function setScreenName ( options : SetScreenNameOptions ) : Promise < any > ;
Original file line number Diff line number Diff line change @@ -851,12 +851,16 @@ firebase.admob.showBanner = arg => {
851851 adRequest . testDevices = testDevices ;
852852 }
853853
854+ if ( settings . keywords !== undefined ) {
855+ adRequest . keywords = settings . keywords ;
856+ }
857+
854858 firebase . admob . adView . rootViewController = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) . keyWindow . rootViewController ;
855859 // var statusbarFrame = utils.ios.getter(UIApplication, UIApplication.sharedApplication).statusBarFrame;
856860
857861 firebase . admob . adView . loadRequest ( adRequest ) ;
858862
859- // TODO consider listening to delegate features like 'ad loaded'
863+ // TODO consider listening to delegate features like 'ad loaded' (Android resolves when the banner is actually showing)
860864 // adView.delegate = self;
861865
862866 view . addSubview ( firebase . admob . adView ) ;
@@ -1967,6 +1971,7 @@ firebase.downloadFile = arg => {
19671971 try {
19681972
19691973 const onCompletion = ( url , error ) => {
1974+ console . log ( ">>> download complete, error: " + error ) ;
19701975 if ( error ) {
19711976 reject ( error . localizedDescription ) ;
19721977 } else {
You can’t perform that action at this time.
0 commit comments