Skip to content

Commit

Permalink
added admob
Browse files Browse the repository at this point in the history
  • Loading branch information
artur-ios-dev committed Mar 6, 2020
1 parent 5d5ce8e commit c570c08
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 17 deletions.
7 changes: 7 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name="io.flutter.app.FlutterApplication"
android:label="Watermaniac"
Expand All @@ -26,5 +29,9 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~1458002511"/>
</application>
</manifest>
123 changes: 120 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,88 @@
PODS:
- Firebase/AdMob (6.18.0):
- Firebase/CoreOnly
- Google-Mobile-Ads-SDK (~> 7.50)
- Firebase/Core (6.18.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 6.3.0)
- Firebase/CoreOnly (6.18.0):
- FirebaseCore (= 6.6.3)
- firebase_admob (0.0.1):
- Firebase/AdMob
- Firebase/Core
- Flutter
- firebase_core (0.0.1):
- Firebase/Core
- Flutter
- firebase_core_web (0.1.0):
- Flutter
- FirebaseAnalytics (6.3.0):
- FirebaseCore (~> 6.6)
- FirebaseInstallations (~> 1.1)
- GoogleAppMeasurement (= 6.3.0)
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
- GoogleUtilities/MethodSwizzler (~> 6.0)
- GoogleUtilities/Network (~> 6.0)
- "GoogleUtilities/NSData+zlib (~> 6.0)"
- nanopb (= 0.3.9011)
- FirebaseCore (6.6.3):
- FirebaseCoreDiagnostics (~> 1.2)
- FirebaseCoreDiagnosticsInterop (~> 1.2)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/Logger (~> 6.5)
- FirebaseCoreDiagnostics (1.2.1):
- FirebaseCoreDiagnosticsInterop (~> 1.2)
- GoogleDataTransportCCTSupport (~> 1.3)
- GoogleUtilities/Environment (~> 6.5)
- GoogleUtilities/Logger (~> 6.5)
- nanopb (~> 0.3.901)
- FirebaseCoreDiagnosticsInterop (1.2.0)
- FirebaseInstallations (1.1.0):
- FirebaseCore (~> 6.6)
- GoogleUtilities/UserDefaults (~> 6.5)
- PromisesObjC (~> 1.2)
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
- Flutter
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- Google-Mobile-Ads-SDK (7.56.0):
- GoogleAppMeasurement (~> 6.0)
- GoogleAppMeasurement (6.3.0):
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
- GoogleUtilities/MethodSwizzler (~> 6.0)
- GoogleUtilities/Network (~> 6.0)
- "GoogleUtilities/NSData+zlib (~> 6.0)"
- nanopb (= 0.3.9011)
- GoogleDataTransport (4.0.1)
- GoogleDataTransportCCTSupport (1.4.1):
- GoogleDataTransport (~> 4.0)
- nanopb (~> 0.3.901)
- GoogleUtilities/AppDelegateSwizzler (6.5.1):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (6.5.1)
- GoogleUtilities/Logger (6.5.1):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (6.5.1):
- GoogleUtilities/Logger
- GoogleUtilities/Network (6.5.1):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (6.5.1)"
- GoogleUtilities/Reachability (6.5.1):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (6.5.1):
- GoogleUtilities/Logger
- nanopb (0.3.9011):
- nanopb/decode (= 0.3.9011)
- nanopb/encode (= 0.3.9011)
- nanopb/decode (0.3.9011)
- nanopb/encode (0.3.9011)
- PromisesObjC (1.2.8)
- shared_preferences (0.0.1):
- Flutter
- shared_preferences_macos (0.0.1):
Expand All @@ -16,6 +94,9 @@ PODS:
- FMDB (~> 2.7.2)

DEPENDENCIES:
- firebase_admob (from `.symlinks/plugins/firebase_admob/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`)
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
Expand All @@ -24,10 +105,30 @@ DEPENDENCIES:
- sqflite (from `.symlinks/plugins/sqflite/ios`)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
https://github.com/CocoaPods/Specs.git:
- FMDB
trunk:
- Firebase
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCoreDiagnosticsInterop
- FirebaseInstallations
- Google-Mobile-Ads-SDK
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleDataTransportCCTSupport
- GoogleUtilities
- nanopb
- PromisesObjC

EXTERNAL SOURCES:
firebase_admob:
:path: ".symlinks/plugins/firebase_admob/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_core_web:
:path: ".symlinks/plugins/firebase_core_web/ios"
Flutter:
:path: Flutter
flutter_local_notifications:
Expand All @@ -42,14 +143,30 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sqflite/ios"

SPEC CHECKSUMS:
Firebase: 0490eca762a72e4f1582319539153897f1508dee
firebase_admob: d8c2bc95b5e0069406280ce6adb816cdee6aa595
firebase_core: 920b9b2a74489a0cf6c5009b744f7f7f5fd84cf6
firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1
FirebaseAnalytics: 058d71e714a1a6804d9e0f25e3bb18e377a51579
FirebaseCore: 78276943ad85e616dfa54dafa6c89512987d9d60
FirebaseCoreDiagnostics: 2109d10c35e8289b1ee6cabf44d9ffb055620194
FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850
FirebaseInstallations: 575cd32f2aec0feeb0e44f5d0110a09e5e60b47b
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
Google-Mobile-Ads-SDK: 65e335fadc97c5a91a9d4546214bfd3a2fb11047
GoogleAppMeasurement: 39ecba10918b21c83877d392246157f65db351cf
GoogleDataTransport: 653963cf5be60fb59cf051e070f0836fdc305f81
GoogleDataTransportCCTSupport: 84e4d4bbab642f2e9d83ee65d78aca2b5527d314
GoogleUtilities: 06eb53bb579efe7099152735900dd04bf09e7275
nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd
PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
sqflite: ff1d9da63c06588cc8d1faf7256d741f16989d5a
sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0

PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83

COCOAPODS: 1.7.5
COCOAPODS: 1.9.0
2 changes: 2 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3635896848060057~4783836821</string>
</dict>
</plist>
28 changes: 27 additions & 1 deletion lib/screens/home/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:firebase_admob/firebase_admob.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -30,15 +31,37 @@ class HomePage extends StatefulWidget {
}

class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
static const MobileAdTargetingInfo _targetingInfo = MobileAdTargetingInfo(
keywords: <String>['fortnite', 'skins', 'game', 'battle royale'],
contentUrl: 'https://getfoyl.com',
childDirected: false,
testDevices: <String>[], // Android emulators are considered test devices
);

BannerAd _bannerAd;

BannerAd createBannerAd() {
return BannerAd(
adUnitId: BannerAd.testAdUnitId,
size: AdSize.banner,
targetingInfo: _targetingInfo,
);
}

void initState() {
super.initState();

WidgetsBinding.instance.addObserver(this);
FirebaseAdMob.instance.initialize(appId: FirebaseAdMob.testAppId);
_bannerAd = createBannerAd()
..load()
..show(anchorOffset: 25, anchorType: AnchorType.top);
}

@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
_bannerAd?.dispose();
super.dispose();
}

Expand Down Expand Up @@ -158,7 +181,10 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
'assets/background/top-background.png'),
fit: BoxFit.fitWidth)),
),
_getBody(index),
Padding(
padding: EdgeInsets.only(top: 40),
child: _getBody(index),
),
],
));
},
Expand Down
75 changes: 69 additions & 6 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
firebase:
dependency: transitive
description:
name: firebase
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.1"
firebase_admob:
dependency: "direct main"
description:
name: firebase_admob
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.1+3"
firebase_core:
dependency: transitive
description:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.4+2"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1+2"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -82,14 +117,14 @@ packages:
name: flutter_redux
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.4"
version: "0.6.0"
flutter_svg:
dependency: "direct main"
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
version: "0.17.2"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -100,6 +135,20 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+4"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
image:
dependency: transitive
description:
Expand All @@ -114,6 +163,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+1"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -170,6 +226,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
quiver:
dependency: transitive
description:
Expand All @@ -183,14 +246,14 @@ packages:
name: redux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "4.0.0"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.6"
version: "0.5.6+2"
shared_preferences_macos:
dependency: transitive
description:
Expand Down Expand Up @@ -230,7 +293,7 @@ packages:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.0+1"
version: "1.2.1"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -295,5 +358,5 @@ packages:
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.5.0 <3.0.0"
dart: ">=2.7.0-dev <3.0.0"
flutter: ">=1.12.13+hotfix.4 <2.0.0"
Loading

0 comments on commit c570c08

Please sign in to comment.