Skip to content

Commit

Permalink
Merge pull request #80 from Astrovic/master
Browse files Browse the repository at this point in the history
Support the Facebook Audience Network mediation
  • Loading branch information
hansemannn authored Jul 1, 2018
2 parents e974eff + 8c95ad5 commit ba7b5c1
Show file tree
Hide file tree
Showing 43 changed files with 2,622 additions and 20 deletions.
2 changes: 2 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ repositories {

dependencies {
implementation 'com.google.android.ads.consent:consent-library:1.0.1'
implementation 'com.facebook.android:audience-network-sdk:4.28.2'
implementation 'com.google.ads.mediation:facebook:4.28.2.0'
}

task getDeps(type: Copy) {
Expand Down
9 changes: 6 additions & 3 deletions android/documentation/changelog.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Change Log

<pre>
v4.2.1 Fix Kroll annotation for requestConsentInfoUpdateForPublisherIdentifiers.
v4.3.0 Support the Facebook Audience Network adapter
Android integration guide: https://developers.google.com/admob/android/mediation/facebook

v4.2.1 Fix Kroll annotation for requestConsentInfoUpdateForPublisherIdentifiers.

v4.2.0 Expose getId() and isAdTrackingLimited() from AdvertisingIdClient.Info.
v4.2.0 Expose getId() and isAdTrackingLimited() from AdvertisingIdClient.Info.

v4.1.0 Conform to GDPR by exposing the `extras` object to `requestAd()` [MOD-2423]

v4.0.0 Support Titanium SDK 7.0.0 and Android 64-Bit, use Ti.PlayServices

v3.0.2 Bump Google Play Services to 10.2.0 [TIMOB-24722]
v3.0.2 Bump Google Play Services to 10.2.0 [TIMOB-24722]

v3.0.1 Update Google Play Services to v9.6.1 (revison 33) [TIMOB-23860]

Expand Down
22 changes: 15 additions & 7 deletions android/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

## Description

Allows for the display of AdMob in Titanium Android applications.
Allows for the display of AdMob in Titanium Android applications.

Please note that if your androidManifest has screen support set to: android:anyDensity="false", any banner ads will display too small on high density devices.
It is not clear at this point if this is a bug with AdMob or Titanium.
Please note that if your androidManifest has screen support set to: android:anyDensity="false", any banner ads will
display too small on high density devices.
It is not clear at this point if this is a bug with AdMob or Titanium.
In any event, you will either need to NOT set your screen support -- or set android:anyDensity="true" and adjust your app layout accordingly

## Getting Started

View the [Using Titanium Modules](http://docs.appcelerator.com/titanium/latest/#!/guide/Using_Titanium_Modules) document for instructions on getting
started with using this module in your application.
View the [Using Titanium Modules](http://docs.appcelerator.com/titanium/latest/#!/guide/Using_Titanium_Modules) document
for instructions on getting started with using this module in your application.

## Requirements

Expand All @@ -26,7 +27,7 @@ To access this module from JavaScript, you would do the following (recommended):
var Admob = require('ti.admob');
```

The "Admob" variable is now a reference to the Module object.
The "Admob" variable is now a reference to the Module object.

## Doubleclick for Publishers Developer Docs

Expand All @@ -38,7 +39,8 @@ The "Admob" variable is now a reference to the Module object.

Returns a number value indicating the availability of Google Play Services which are for push notifications.

Possible values include `SUCCESS`, `SERVICE_MISSING`, `SERVICE_VERSION_UPDATE_REQUIRED`, `SERVICE_DISABLED`, and `SERVICE_INVALID`.
Possible values include `SUCCESS`, `SERVICE_MISSING`, `SERVICE_VERSION_UPDATE_REQUIRED`, `SERVICE_DISABLED`,
and `SERVICE_INVALID`.

### `createAdMobView(args)`

Expand Down Expand Up @@ -180,6 +182,12 @@ and a boolean value for the user's setting.
Ti.API.info('Ad tracking is limited: ' + data.isLimitAdTrackingEnabled);
});

### Support the Facebook Audience Network adapter

Starting in 4.3.0 you can use the included Facebook Audience Network adapter to turn on the mediation in your AdMob account.
Here you do not have to do anything 😙. You only need to configure mediation in your AdMob and Facebook accounts by
following the [official guide](https://developers.google.com/admob/android/mediation/facebook).

## Constants

### Number `SUCCESS`
Expand Down
Binary file added android/lib/audience-network-sdk-4.28.2.aar
Binary file not shown.
Binary file added android/lib/facebook-4.28.2.0.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# during compilation, packaging, distribution, etc.
#

version: 4.2.1
version: 4.3.0
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86
description: Titanium Admob module for Android
Expand Down
8 changes: 8 additions & 0 deletions ios/admob.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
24DD6CFA1134B3F500162E58 /* TiAdmobModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DD6CF81134B3F500162E58 /* TiAdmobModule.m */; };
3A4F268F1C68DDF7003E06CF /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A4F268E1C68DDF7003E06CF /* iAd.framework */; };
3AF5B7731C233383002E3DC7 /* TiAdmobTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AF5B7711C233383002E3DC7 /* TiAdmobTypes.h */; };
5E32C3FB20E2957400A17A2B /* FBAudienceNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E32C3F920E2957400A17A2B /* FBAudienceNetwork.framework */; };
5E32C3FC20E2957400A17A2B /* FacebookAdapter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E32C3FA20E2957400A17A2B /* FacebookAdapter.framework */; };
AA747D9F0F9514B9006C5449 /* TiAdmob_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* TiAdmob_Prefix.pch */; };
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
CE6C17A01982D1170017C788 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE6C179F1982D1170017C788 /* AdSupport.framework */; };
Expand Down Expand Up @@ -48,6 +50,8 @@
24DD6D1B1134B66800162E58 /* titanium.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = titanium.xcconfig; sourceTree = "<group>"; };
3A4F268E1C68DDF7003E06CF /* iAd.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iAd.framework; path = System/Library/Frameworks/iAd.framework; sourceTree = SDKROOT; };
3AF5B7711C233383002E3DC7 /* TiAdmobTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiAdmobTypes.h; path = Classes/TiAdmobTypes.h; sourceTree = "<group>"; };
5E32C3F920E2957400A17A2B /* FBAudienceNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBAudienceNetwork.framework; path = platform/FBAudienceNetwork.framework; sourceTree = "<group>"; };
5E32C3FA20E2957400A17A2B /* FacebookAdapter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FacebookAdapter.framework; path = platform/FacebookAdapter.framework; sourceTree = "<group>"; };
AA747D9E0F9514B9006C5449 /* TiAdmob_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiAdmob_Prefix.pch; sourceTree = SOURCE_ROOT; };
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
CE6C179F1982D1170017C788 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -84,12 +88,14 @@
DAD5D7CF12527E11009CF986 /* AudioToolbox.framework in Frameworks */,
CE6C17A21982D12D0017C788 /* AVFoundation.framework in Frameworks */,
CE6C17A41982D13A0017C788 /* CoreGraphics.framework in Frameworks */,
5E32C3FB20E2957400A17A2B /* FBAudienceNetwork.framework in Frameworks */,
DB07E8B81E8010000008C1E1 /* CoreMedia.framework in Frameworks */,
DB07E8B91E8010000008C1E1 /* CoreMotion.framework in Frameworks */,
CE6C17A61982D1660017C788 /* CoreTelephony.framework in Frameworks */,
DB07E8BB1E80100D0008C1E1 /* CoreVideo.framework in Frameworks */,
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */,
DB07E8BD1E80101A0008C1E1 /* GLKit.framework in Frameworks */,
5E32C3FC20E2957400A17A2B /* FacebookAdapter.framework in Frameworks */,
DB07E8BF1E80101F0008C1E1 /* JavaScriptCore.framework in Frameworks */,
DB07E8C01E80103C0008C1E1 /* MediaPlayer.framework in Frameworks */,
DAD5D7D512527E2F009CF986 /* MessageUI.framework in Frameworks */,
Expand Down Expand Up @@ -126,6 +132,8 @@
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
isa = PBXGroup;
children = (
5E32C3FA20E2957400A17A2B /* FacebookAdapter.framework */,
5E32C3F920E2957400A17A2B /* FBAudienceNetwork.framework */,
DB28410320B413750099933A /* PersonalizedAdConsent.framework */,
DB2840FA20B408760099933A /* GoogleMobileAds.framework */,
DB07E8C51E8010680008C1E1 /* SafariServices.framework */,
Expand Down
7 changes: 5 additions & 2 deletions ios/documentation/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log
<pre>
v2.4.0 Support the Facebook Audience Network adapter
iOS integration guide: https://developers.google.com/admob/ios/mediation/facebook

v2.3.0 [MOD-2196] Update AdMob to 7.31.0, conform to GDPR

v2.2.0 Update Admob iOS SDK to 7.27.0, remove iAd adapter due to Google removal
Expand All @@ -8,7 +11,7 @@ v2.1.0 [MOD-2196] Support the iAd adapter

v2.0.0 [MOD-2182] Updating Admob SDK to 7.6.0, support iOS 9, support for new API's'

v1.9.0 [TIMOB-18092] ti.admob added 64bit support for iOS #15
v1.9.0 [TIMOB-18092] ti.admob added 64bit support for iOS #15

v1.8.0 [TIMOB-17928] Updated to build for 64-bit

Expand All @@ -22,7 +25,7 @@ v1.6.0 [TIMODOPEN-427] Updating Admob SDK to 6.10.0, Building with TiSDK 3.2.3.
v1.5.0 [TIMODOPEN-242] Updating Admob SDK to 6.4.2 (Removed all uses of UDID)

v1.4.0 [TIMODOPEN-212] Updating Admob SDK to 6.2.1, Building with TiSDK 2.1.3.GA, update documentation

v1.3 Fixed crash on iOS 4.3 [MOD-600]

v1.2 Upgraded to SDK 5.0.5 [MOD-410]
Expand Down
11 changes: 7 additions & 4 deletions ios/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ parameters[object]: a dictionary object of properties defined in [Ti.Admob.View]

```js
var ad = Admob.createView({
bottom: 0,
bottom: 0,
width: 320, // Will calculate the width internally to fit its container if not specified
height: 50,
debugEnabled: true, // If enabled, a dummy value for `adUnitId` will be used to test
adType: Admob.AD_TYPE_BANNER, // One of `AD_TYPE_BANNER` (default) or `AD_TYPE_INTERSTITIAL`
adUnitId: '<<YOUR ADD UNIT ID HERE>>', // You can get your own at http: //www.admob.com/
adBackgroundColor: 'black',
adBackgroundColor: 'black',
testDevices: [Admob.SIMULATOR_ID], // You can get your device's id by looking in the console log
contentURL: 'https://admob.com', // URL string for a webpage whose content matches the app content.
requestAgent: 'Titanium Mobile App', // String that identifies the ad request's origin.
Expand Down Expand Up @@ -122,8 +122,8 @@ Debug geography. Used for debug devices only.

### Interstitials

To receive an interstitional ad, you need to call `ad.receive()` instead of adding it to the viewe hierarchy.
It fires the `didReceiveAd` event if the ad was successfully received, the `didFailToReceiveAd` event otherwise. Please check
To receive an interstitional ad, you need to call `ad.receive()` instead of adding it to the viewe hierarchy.
It fires the `didReceiveAd` event if the ad was successfully received, the `didFailToReceiveAd` event otherwise. Please check
the example for a detailed example of different banner types.

### iAd
Expand All @@ -132,6 +132,9 @@ the example for a detailed example of different banner types.

Starting in 2.1.0 you can use the included iAd adapter to turn on the iAd mediation in your Admob account.

### Support the Facebook Audience Network adapter

Starting in 2.4.0 you can use the included Facebook Audience Network adapter to turn on the mediation in your Admob account. Here you do not have to do anything :) You only need to configure mediation in your AdMob and Facebbok accounts by following the official guide: https://developers.google.com/admob/ios/mediation/facebook

## Constants

Expand Down
2 changes: 1 addition & 1 deletion ios/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 2.3.0
version: 2.4.0
architectures: armv7 i386 x86_64 arm64
description: AdMob module for ad delivery via AdMob
author: Jeff Haynie, Stephen Tramer, Jasper Kennis, Jon Alter and Hans Knoechel
Expand Down
2 changes: 1 addition & 1 deletion ios/module.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OTHER_LDFLAGS=$(inherited) -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CoreGraphics -framework CoreMedia -framework CoreMotion -framework CoreTelephony -framework CoreVideo -framework Foundation -framework GLKit -framework JavaScriptCore -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework OpenGLES -framework SafariServices -framework iAd -framework StoreKit -framework SystemConfiguration -framework WebKit -framework GoogleMobileAds -framework PersonalizedAdConsent
OTHER_LDFLAGS=$(inherited) -framework AdSupport -framework AudioToolbox -framework AVFoundation -framework CoreGraphics -framework CoreMedia -framework CoreMotion -framework CoreTelephony -framework CoreVideo -framework Foundation -framework GLKit -framework JavaScriptCore -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework OpenGLES -framework SafariServices -framework iAd -framework StoreKit -framework SystemConfiguration -framework WebKit -framework GoogleMobileAds -framework PersonalizedAdConsent -framework FacebookAdapter -framework FBAudienceNetwork
Binary file not shown.
108 changes: 108 additions & 0 deletions ios/platform/FBAudienceNetwork.framework/Headers/FBAdChoicesView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// Copyright 2004-present Facebook. All Rights Reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <UIKit/UIKit.h>

#import <FBAudienceNetwork/FBAdDefines.h>

NS_ASSUME_NONNULL_BEGIN

@class FBAdImage;
@class FBNativeAd;
@class FBNativeAdViewAttributes;

/**
FBAdChoicesView offers a simple way to display a sponsored or AdChoices icon.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBAdChoicesView : UIView

/**
Access to the text label contained in this view.
*/
@property (nonatomic, weak, readonly, nullable) UILabel *label;

/**
Determines whether the background mask is shown, or a transparent mask is used.
*/
@property (nonatomic, assign, getter=isBackgroundShown) BOOL backgroundShown;

/**
Determines whether the view can be expanded upon being tapped, or defaults to fullsize. Defaults to NO.
*/
@property (nonatomic, assign, readonly, getter=isExpandable) BOOL expandable;

/**
The native ad that provides AdChoices info, such as the image url, and click url. Setting this updates the nativeAd.
*/
@property (nonatomic, weak, readwrite, nullable) FBNativeAd *nativeAd;

/**
Affects background mask rendering. Setting this property updates the rendering.
*/
@property (nonatomic, assign, readwrite) UIRectCorner corner;

/**
The view controller to present the ad choices info from. If nil, the top view controller is used.
*/
@property (nonatomic, weak, readwrite, null_resettable) UIViewController *rootViewController;

/**
Initialize this view with a given native ad. Configuration is pulled from the native ad.
- Parameter nativeAd: The native ad to initialize with.
*/
- (instancetype)initWithNativeAd:(FBNativeAd *)nativeAd;

/**
Initialize this view with a given native ad. Configuration is pulled from the native ad.
- Parameter nativeAd: The native ad to initialize with.
- Parameter expandable: Controls whether view defaults to expanded or not, see property documentation
*/
- (instancetype)initWithNativeAd:(FBNativeAd *)nativeAd
expandable:(BOOL)expandable;

/**
Initialize this view with a given native ad. Configuration is pulled from the native ad.
- Parameter nativeAd: The native ad to initialize with.
- Parameter expandable: Controls whether view defaults to expanded or not, see property documentation
- Parameter attributes: Attributes to configure look and feel.
*/
- (instancetype)initWithNativeAd:(FBNativeAd *)nativeAd
expandable:(BOOL)expandable
attributes:(nullable FBNativeAdViewAttributes *)attributes;

/**
Using the superview, this updates the frame of this view, positioning the icon in the top right corner by default.
*/
- (void)updateFrameFromSuperview;

/**
Using the superview, this updates the frame of this view, positioning the icon in the corner specified. UIRectCornerAllCorners not supported.
- Parameter corner: The corner to display this view from.
- Parameter insets: Insets to take into account when positioning the view. Only respective insets are applied to corners.
*/
- (void)updateFrameFromSuperview:(UIRectCorner)corner;
- (void)updateFrameFromSuperview:(UIRectCorner)corner insets:(UIEdgeInsets)insets;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit ba7b5c1

Please sign in to comment.