Skip to content

Commit

Permalink
removed firebase_admob
Browse files Browse the repository at this point in the history
  • Loading branch information
LiquidatorCoder committed Sep 27, 2020
1 parent d26d4ea commit 244efce
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 115 deletions.
3 changes: 0 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
android:name="io.flutter.app.FlutterApplication"
android:label="GGSIPU Notices"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-4649644680694757~9217941552"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/notification" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
@Keep
public final class GeneratedPluginRegistrant {
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
flutterEngine.getPlugins().add(new io.flutter.plugins.firebaseadmob.FirebaseAdMobPlugin());
flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.core.FirebaseCorePlugin());
flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.database.FirebaseDatabasePlugin());
flutterEngine.getPlugins().add(new io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin());
Expand Down
7 changes: 0 additions & 7 deletions ios/Runner/GeneratedPluginRegistrant.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@

#import "GeneratedPluginRegistrant.h"

#if __has_include(<firebase_admob/FLTFirebaseAdMobPlugin.h>)
#import <firebase_admob/FLTFirebaseAdMobPlugin.h>
#else
@import firebase_admob;
#endif

#if __has_include(<firebase_core/FLTFirebaseCorePlugin.h>)
#import <firebase_core/FLTFirebaseCorePlugin.h>
#else
Expand Down Expand Up @@ -37,7 +31,6 @@
@implementation GeneratedPluginRegistrant

+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[FLTFirebaseAdMobPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseAdMobPlugin"]];
[FLTFirebaseCorePlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseCorePlugin"]];
[FLTFirebaseDatabasePlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseDatabasePlugin"]];
[FLTFirebaseMessagingPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTFirebaseMessagingPlugin"]];
Expand Down
81 changes: 40 additions & 41 deletions lib/screens/home.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/services.dart';
import 'package:ggsipu_notice/keys.dart';
import 'package:firebase_admob/firebase_admob.dart';
// import 'package:ggsipu_notice/keys.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
Expand All @@ -21,52 +20,52 @@ class MyHomePage extends StatefulWidget {
}

class _MyHomePageState extends State<MyHomePage> {
Timer _timerForInter;
// Timer _timerForInter;

MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
keywords: <String>['flutterio', 'beautiful apps'],
contentUrl: 'https://flutter.io',
childDirected: false,
// testDevices: <String>["9033810B9AD198E151CFEC2CB5073E2B"],
testDevices: <String>[],
);
InterstitialAd _interstitialAd;
// MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
// keywords: <String>['flutterio', 'beautiful apps'],
// contentUrl: 'https://flutter.io',
// childDirected: false,
// // testDevices: <String>["9033810B9AD198E151CFEC2CB5073E2B"],
// testDevices: <String>[],
// );
// InterstitialAd _interstitialAd;

InterstitialAd createInterstitialAd(int index) {
return InterstitialAd(
// adUnitId: InterstitialAd.testAdUnitId,
adUnitId: adUnitId,
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("InterstitialAd event $event");
if (event == MobileAdEvent.closed) {
print('Interstitial closed');
if (index != null) {
Navigator.pop(context);
String link = "http://www.ipu.ac.in${lists[index]["url"]}";
_launchURL(link);
}
} else if (event == MobileAdEvent.failedToLoad) {
if (index != null) {
Navigator.pop(context);
String link = "http://www.ipu.ac.in${lists[index]["url"]}";
_launchURL(link);
}
}
},
);
}
// InterstitialAd createInterstitialAd(int index) {
// return InterstitialAd(
// // adUnitId: InterstitialAd.testAdUnitId,
// adUnitId: adUnitId,
// targetingInfo: targetingInfo,
// listener: (MobileAdEvent event) {
// print("InterstitialAd event $event");
// if (event == MobileAdEvent.closed) {
// print('Interstitial closed');
// if (index != null) {
// Navigator.pop(context);
// String link = "http://www.ipu.ac.in${lists[index]["url"]}";
// _launchURL(link);
// }
// } else if (event == MobileAdEvent.failedToLoad) {
// if (index != null) {
// Navigator.pop(context);
// String link = "http://www.ipu.ac.in${lists[index]["url"]}";
// _launchURL(link);
// }
// }
// },
// );
// }

@override
void initState() {
FirebaseAdMob.instance.initialize(appId: appId);
// FirebaseAdMob.instance.initialize(appId: appId);
super.initState();
}

@override
void dispose() {
_timerForInter.cancel();
_interstitialAd.dispose();
// _timerForInter.cancel();
// _interstitialAd.dispose();
super.dispose();
}

Expand Down Expand Up @@ -135,9 +134,9 @@ class _MyHomePageState extends State<MyHomePage> {
child: CupertinoActivityIndicator(),
),
));
var _interstitialAd1 = createInterstitialAd(index);
await _interstitialAd1.load();
_interstitialAd1.show();
// var _interstitialAd1 = createInterstitialAd(index);
// await _interstitialAd1.load();
// _interstitialAd1.show();
});
},
childCount: lists.length,
Expand Down
87 changes: 26 additions & 61 deletions pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,83 +1,69 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
version: "2.4.2"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
charcode:
characters:
dependency: transitive
description:
name: charcode
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
collection:
version: "1.0.0"
charcode:
dependency: transitive
description:
name: collection
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.12"
convert:
version: "1.1.3"
clock:
dependency: transitive
description:
name: convert
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
version: "1.0.1"
collection:
dependency: transitive
description:
name: crypto
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "1.14.13"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
firebase:
fake_async:
dependency: transitive
description:
name: firebase
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "7.3.0"
firebase_admob:
dependency: "direct main"
version: "1.1.0"
firebase:
dependency: transitive
description:
name: firebase_admob
name: firebase
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.3+4"
version: "7.3.0"
firebase_core:
dependency: transitive
description:
Expand Down Expand Up @@ -149,13 +135,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
js:
dependency: transitive
description:
Expand All @@ -169,7 +148,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.6"
version: "0.12.8"
meta:
dependency: transitive
description:
Expand All @@ -183,21 +162,14 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -251,7 +223,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
version: "1.9.5"
stream_channel:
dependency: transitive
description:
Expand Down Expand Up @@ -279,14 +251,14 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
version: "0.2.17"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.2.0"
url_launcher:
dependency: "direct main"
description:
Expand Down Expand Up @@ -329,13 +301,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.7.0 <3.0.0"
dart: ">=2.9.0-14.0.dev <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
firebase_admob: ^0.9.3+4
# firebase_admob: ^0.9.3+4

dev_dependencies:
flutter_test:
Expand All @@ -45,7 +45,6 @@ flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- assets/icons/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
Expand Down

0 comments on commit 244efce

Please sign in to comment.