Skip to content

Commit

Permalink
Release 1.0.0-nullsafety.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SachinGanesh committed Jun 20, 2021
1 parent 1855107 commit c2464d3
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 44 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 0.9.0
## 1.0.0-nullsafety.0
- Add nullsafety - PR by @RR-Reddy
- Add support for iOSAdvertiserTrackingEnabled flag - default: false

## 0.9.0
- Bumped up Audience Network SDK to v6.3.0

## 0.8.0
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| - | - |
| ![Interstitial Ad](https://raw.githubusercontent.com/dreamsoftin/facebook_audience_network/master/example/gifs/interstitial.gif "Interstitial Ad") | ![Rewarded Ad](https://raw.githubusercontent.com/dreamsoftin/facebook_audience_network/master/example/gifs/rewarded.gif "Rewarded Video Ad") |


---
## Getting Started

### 1. Initialization:
Expand All @@ -29,13 +29,15 @@ The hased id will be in printed to the logcat. Paste that onto the `testingId` p
```dart
FacebookAudienceNetwork.init(
testingId: "37b1da9d-b48c-4103-a393-2e095e734bd6", //optional
iOSAdvertiserTrackingEnabled: true //default false
);
```
##### IOS Setup
In Pod file, set the IOS deployment target version to 9.0

*IN iOS, Banner, Interstital and Native Ads are supported*

---
### 2. Show Banner Ad:

```dart
Expand Down Expand Up @@ -63,7 +65,7 @@ Container(
),
)
```

---
### 3. Show Interstitial Ad:

```dart
Expand All @@ -75,6 +77,7 @@ FacebookInterstitialAd.loadInterstitialAd(
},
);
```
---
### 4. Show Rewarded Video Ad:
(Android Only)

Expand All @@ -89,7 +92,7 @@ FacebookRewardedVideoAd.loadRewardedVideoAd(
},
);
```

---
### 5. Show Native Ad:
- NativeAdType NATIVE_AD_HORIZONTAL & NATIVE_AD_VERTICAL ad types are supported only in iOS. In Android use NATIVE_AD.
```dart
Expand All @@ -112,7 +115,7 @@ FacebookNativeAd(
},
),
```

---
### 6. Show Native Banner Ad:
Use `NativeBannerAdSize` to choose the height for Native banner ads. `height` property is ignored for native banner ads.

Expand All @@ -133,7 +136,7 @@ FacebookNativeAd(
},
),
```

---
**Check out the [example](https://github.com/dreamsoftin/facebook_audience_network/tree/master/example) for complete implementation.**

iOS wrapper code contribution by **lolqplay team from birdgang**
Expand Down
6 changes: 0 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
PODS:
- app_tracking_transparency (0.0.1):
- Flutter
- facebook_audience_network (0.0.1):
- FBAudienceNetwork (~> 6.3)
- Flutter
Expand All @@ -10,7 +8,6 @@ PODS:
- Flutter (1.0.0)

DEPENDENCIES:
- app_tracking_transparency (from `.symlinks/plugins/app_tracking_transparency/ios`)
- facebook_audience_network (from `.symlinks/plugins/facebook_audience_network/ios`)
- Flutter (from `Flutter`)

Expand All @@ -20,15 +17,12 @@ SPEC REPOS:
- FBSDKCoreKit

EXTERNAL SOURCES:
app_tracking_transparency:
:path: ".symlinks/plugins/app_tracking_transparency/ios"
facebook_audience_network:
:path: ".symlinks/plugins/facebook_audience_network/ios"
Flutter:
:path: Flutter

SPEC CHECKSUMS:
app_tracking_transparency: 5b1745ef9ade815f7455cb6a0848349589afb7c5
facebook_audience_network: bb22bdda913d419d8c3247c9570bda4563302417
FBAudienceNetwork: 58b4d0f2359783e5bc9ee59f138b4fda43173ac4
FBSDKCoreKit: fada1a6a0076724678993ff05a633848765ff18c
Expand Down
16 changes: 7 additions & 9 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = LWNWGSMVRA;
DevelopmentTeam = DDVJA87MT8;
LastSwiftMigration = 1130;
};
};
Expand Down Expand Up @@ -275,12 +275,10 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/FBSDKCoreKit/FBSDKCoreKit.framework",
"${BUILT_PRODUCTS_DIR}/app_tracking_transparency/app_tracking_transparency.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBSDKCoreKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/app_tracking_transparency.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -379,7 +377,7 @@
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEFINES_MODULE = NO;
DEVELOPMENT_TEAM = LWNWGSMVRA;
DEVELOPMENT_TEAM = DDVJA87MT8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -392,7 +390,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.rr.interestCalculator;
PRODUCT_BUNDLE_IDENTIFIER = com.dsi.facebookAudienceNetworkExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
Expand Down Expand Up @@ -511,7 +509,7 @@
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEFINES_MODULE = NO;
DEVELOPMENT_TEAM = LWNWGSMVRA;
DEVELOPMENT_TEAM = DDVJA87MT8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -524,7 +522,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.rr.interestCalculator;
PRODUCT_BUNDLE_IDENTIFIER = com.dsi.facebookAudienceNetworkExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
Expand All @@ -542,7 +540,7 @@
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEFINES_MODULE = NO;
DEVELOPMENT_TEAM = LWNWGSMVRA;
DEVELOPMENT_TEAM = DDVJA87MT8;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -555,7 +553,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.rr.interestCalculator;
PRODUCT_BUNDLE_IDENTIFIER = com.dsi.facebookAudienceNetworkExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "$(SWIFT_MODULE_NAME)-Swift.h";
Expand Down
29 changes: 12 additions & 17 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ void main() => runApp(AdExampleApp());
class AdExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {

return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'FB Audience Network Example',
Expand All @@ -27,16 +26,12 @@ class AdExampleApp extends StatelessWidget {
),
);
}


}


class AdsPage extends StatefulWidget {

final String idfa;

const AdsPage({Key? key, this.idfa=''}) : super(key: key);
const AdsPage({Key? key, this.idfa = ''}) : super(key: key);

@override
AdsPageState createState() => AdsPageState();
Expand All @@ -58,22 +53,21 @@ class AdsPageState extends State<AdsPage> {
void initState() {
super.initState();


/// please add your own device testingId
/// (testingId will print in console if you don't provide )
FacebookAudienceNetwork.init(
testingId: "a77955ee-3304-4635-be65-81029b0f5201",
iOSAdvertiserTrackingEnabled: true,
);


_loadInterstitialAd();
_loadRewardedVideoAd();
}

void _loadInterstitialAd() {
FacebookInterstitialAd.loadInterstitialAd(
placementId:
"YOUR_PLACEMENT_ID", //"IMG_16_9_APP_INSTALL#2312433698835503_2650502525028617" YOUR_PLACEMENT_ID
// placementId: "YOUR_PLACEMENT_ID",
placementId: "IMG_16_9_APP_INSTALL#2312433698835503_2650502525028617",
listener: (result, value) {
print(">> FAN > Interstitial Ad: $result --> $value");
if (result == InterstitialAdResult.LOADED)
Expand Down Expand Up @@ -189,9 +183,10 @@ class AdsPageState extends State<AdsPage> {

_showBannerAd() {
setState(() {
_currentAd = FacebookBannerAd(placementId: "YOUR_PLACEMENT_ID",
// placementId:
// "IMG_16_9_APP_INSTALL#2312433698835503_2964944860251047", //testid
_currentAd = FacebookBannerAd(
// placementId: "YOUR_PLACEMENT_ID",
placementId:
"IMG_16_9_APP_INSTALL#2312433698835503_2964944860251047", //testid
bannerSize: BannerSize.STANDARD,
listener: (result, value) {
print("Banner Ad: $result --> $value");
Expand All @@ -207,8 +202,9 @@ class AdsPageState extends State<AdsPage> {
}

Widget _nativeBannerAd() {
return FacebookNativeAd(placementId: "YOUR_PLACEMENT_ID",
// placementId: "IMG_16_9_APP_INSTALL#2312433698835503_2964953543583512",
return FacebookNativeAd(
// placementId: "YOUR_PLACEMENT_ID",
placementId: "IMG_16_9_APP_INSTALL#2312433698835503_2964953543583512",
adType: NativeAdType.NATIVE_BANNER_AD,
bannerAdSize: NativeBannerAdSize.HEIGHT_100,
width: double.infinity,
Expand All @@ -232,7 +228,7 @@ class AdsPageState extends State<AdsPage> {

Widget _nativeAd() {
return FacebookNativeAd(
// placementId: "IMG_16_9_APP_INSTALL#2312433698835503_2964952163583650",
placementId: "IMG_16_9_APP_INSTALL#2312433698835503_2964952163583650",
adType: NativeAdType.NATIVE_AD_VERTICAL,
width: double.infinity,
height: 300,
Expand All @@ -250,4 +246,3 @@ class AdsPageState extends State<AdsPage> {
);
}
}

Loading

0 comments on commit c2464d3

Please sign in to comment.