cordova-plugin-admob-nextgen 2.0.3-beta.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -117,7 +117,7 @@ This plugin is regularly updated to support the latest standards.
117
117
  | :--- | :--- | :--- | :--- |
118
118
  | **GMA Next-Gen SDK** | Android | **1.4.0** | [View Notes](https://developers.google.com/admob/android/next-gen/rel-notes) |
119
119
  | **UMP SDK** | Android | **4.0.0** | [View Notes](https://developers.google.com/admob/android/privacy/release-notes) |
120
- | **Mobile Ads SDK** | iOS | **13.3.0** | [View Notes](https://developers.google.com/admob/ios/rel-notes) |
120
+ | **Mobile Ads SDK** | iOS | **13.10.0** | [View Notes](https://developers.google.com/admob/ios/rel-notes) |
121
121
  | **UMP SDK** | iOS | **3.1.0** | [View Notes](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/privacy/download) |
122
122
 
123
123
  ### 🎉 View all plugin release notes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-admob-nextgen",
3
- "version": "2.0.3-beta.1",
3
+ "version": "2.0.3",
4
4
  "description": "Google Mobile Ads Next Gen SDK for Cordova. High performance and modular architecture. ",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-admob-nextgen",
package/plugin.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
2
  <plugin id="cordova-plugin-admob-nextgen"
3
- version="2.0.3-beta.1"
3
+ version="2.0.3"
4
4
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
5
5
  xmlns:android="http://schemas.android.com/apk/res/android">
6
6
 
@@ -139,7 +139,7 @@
139
139
  </config>
140
140
  <pods use-frameworks="true">
141
141
  <pod name="GoogleUserMessagingPlatform" spec="~> 3.1.0" />
142
- <pod name="Google-Mobile-Ads-SDK" spec="~> 13.1.0" />
142
+ <pod name="Google-Mobile-Ads-SDK" spec="~> 13.10.0" />
143
143
  </pods>
144
144
  </podspec>
145
145
 
@@ -79,6 +79,11 @@
79
79
  CDVPluginResult* res = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Ad Ready"];
80
80
  [self.plugin.commandDelegate sendPluginResult:res callbackId:command.callbackId];
81
81
  }
82
+
83
+ if (self.isAutoShow) {
84
+ [self showAdIfAvailable];
85
+ }
86
+
82
87
  }
83
88
  return;
84
89
  }
@@ -154,6 +159,12 @@
154
159
  return;
155
160
  }
156
161
 
162
+ if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
163
+ NSString *jsonStr = @"{\"code\":\"APP_IN_BACKGROUND\", \"message\":\"Ad presentation blocked: Application is currently in the background or inactive.\"}";
164
+ [self.plugin fireEvent:@"document" event:@"on.appopen.failed.show" withData:jsonStr];
165
+ return;
166
+ }
167
+
157
168
  self.isShowingAd = YES;
158
169
  [self.appOpenAd presentFromRootViewController:self.plugin.viewController];
159
170
  }
@@ -62,6 +62,11 @@
62
62
  if (self.interstitialAd != nil) {
63
63
 
64
64
  [self.plugin fireEvent:@"document" event:@"on.interstitial.loaded" withData:nil];
65
+
66
+ if (self.isAutoShow) {
67
+ [self showInterstitialAd];
68
+ }
69
+
65
70
  return;
66
71
  }
67
72
 
@@ -131,6 +136,12 @@
131
136
  - (void)showInterstitialAd {
132
137
  if (self.interstitialAd == nil) return;
133
138
 
139
+ if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
140
+ NSString *jsonStr = @"{\"code\":\"APP_IN_BACKGROUND\", \"message\":\"Ad presentation blocked: Application is currently in the background.\"}";
141
+ [self.plugin fireEvent:@"document" event:@"on.interstitial.failed.show" withData:jsonStr];
142
+ return;
143
+ }
144
+
134
145
  [self.interstitialAd presentFromRootViewController:self.plugin.viewController];
135
146
  }
136
147
 
@@ -64,6 +64,11 @@
64
64
  if (self.rewardedAd != nil) {
65
65
 
66
66
  [self.plugin fireEvent:@"document" event:@"on.rewarded.loaded" withData:nil];
67
+
68
+ if (self.isAutoShow) {
69
+ [self showRewardedAd];
70
+ }
71
+
67
72
  return;
68
73
  }
69
74
 
@@ -133,6 +138,12 @@
133
138
  - (void)showRewardedAd {
134
139
  if (self.rewardedAd == nil) return;
135
140
 
141
+ if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
142
+ NSString *jsonStr = @"{\"code\":\"APP_IN_BACKGROUND\", \"message\":\"Ad presentation blocked: Application is currently in the background or inactive.\"}";
143
+ [self.plugin fireEvent:@"document" event:@"on.rewarded.failed.show" withData:jsonStr];
144
+ return;
145
+ }
146
+
136
147
  self.isRewardEarned = NO;
137
148
 
138
149
  [self.rewardedAd presentFromRootViewController:self.plugin.viewController
@@ -72,6 +72,12 @@
72
72
  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Ad Loaded (Cached)"];
73
73
  [self.plugin.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
74
74
  }
75
+
76
+ if (self.isAutoShow) {
77
+
78
+ [self showRewardedInterstitialAd:nil];
79
+ }
80
+
75
81
  return;
76
82
  }
77
83
 
@@ -144,6 +150,17 @@
144
150
  - (void)showRewardedInterstitialAd:(CDVInvokedUrlCommand *)command {
145
151
  if (self.rewardedInterstitialAd != nil) {
146
152
 
153
+ if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
154
+ NSString *jsonStr = @"{\"code\":\"APP_IN_BACKGROUND\", \"message\":\"Ad presentation blocked: Application is currently in the background or inactive.\"}";
155
+ [self.plugin fireEvent:@"document" event:@"on.rewardedInter.failed.show" withData:jsonStr];
156
+
157
+ if (command) {
158
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Ad presentation blocked: Application is in background."];
159
+ [self.plugin.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
160
+ }
161
+ return;
162
+ }
163
+
147
164
  self.isRewardEarned = NO;
148
165
 
149
166
  [self.rewardedInterstitialAd presentFromRootViewController:self.plugin.viewController