Skip to content

Commit

Permalink
Merge branch 'master' into TIMOB-24473
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn authored Jun 25, 2018
2 parents ef93842 + f679d14 commit ed1099d
Show file tree
Hide file tree
Showing 58 changed files with 2,771 additions and 478 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ ios/admob.xcodeproj/project.xcworkspace/xcuserdata/*
android/libs
android/build.properties
android/dist
ios/ti.admob-iphone-*.zip
/android/java-sources.txt
/android/.gradle
26 changes: 26 additions & 0 deletions android/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
Language: Java
AccessModifierOffset: -4
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
# class, constructor, method should be next line
BreakBeforeBraces: Linux
# Keep '=' at end of line when wrapping, but move things like '&&', '||' to beginning of newline
BreakBeforeBinaryOperators: NonAssignment
# FIXME: break for brace after synchronized block, anonymous class declarations
BreakAfterJavaFieldAnnotations: true
ColumnLimit: 120
IndentCaseLabels: true
IndentWidth: 4
MaxEmptyLinesToKeep: 1
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
TabWidth: 4
UseTab: ForContinuationAndIndentation
SpaceAfterCStyleCast: true
# Spaces inside {} for array literals, i.e. "new Object[] { args }"
Cpp11BracedListStyle: false
ReflowComments: false
11 changes: 2 additions & 9 deletions android/.classpath
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="build/.apt_generated"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/google-play-services.jar"/>
<classpathentry kind="lib" path="/Library/Application Support/Titanium/mobilesdk/osx/3.2.3.GA/android/js.jar"/>
<classpathentry kind="lib" path="/Library/Application Support/Titanium/mobilesdk/osx/3.2.3.GA/android/titanium.jar"/>
<classpathentry kind="lib" path="/Library/Application Support/Titanium/mobilesdk/osx/3.2.3.GA/android/kroll-common.jar"/>
<classpathentry kind="lib" path="/Library/Application Support/Titanium/mobilesdk/osx/3.2.3.GA/android/kroll-apt.jar"/>
<classpathentry kind="lib" path="/usr/android-sdk/platforms/android-8/android.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>
8 changes: 7 additions & 1 deletion android/.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>titanium-ti.admob</name>
<name>android</name>
<comment></comment>
<projects>
</projects>
Expand All @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Wed May 23 09:45:19 CEST 2018
connection.project.dir=
18 changes: 18 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apply plugin: 'java'

repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}

dependencies {
implementation 'com.google.android.ads.consent:consent-library:1.0.1'
}

task getDeps(type: Copy) {
from sourceSets.main.runtimeClasspath
exclude 'support-*'
into 'lib'
}
18 changes: 13 additions & 5 deletions android/documentation/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Change Log

<pre>
v3.0.2 Maintain API parity with iOS module

v4.2.0 Maintain API parity with iOS module

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.1 Update Google Play Services to v9.6.1 (revison 33) [TIMOB-23860]

Expand All @@ -17,9 +25,9 @@ v2.1.2 Updating to use google-play-services library [TIMODOPEN-445]
v2.1.1 Updating to use google-play-services library [TIMOB-16940]

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

v2.0.1 Added a note to the documentation about using tool-api-level 14 in the tiapp.xml [MOD-639]

v2.0 Upgraded to module api version 2 for 1.8.0.1
v2.0.1 Added a note to the documentation about using tool-api-level 14 in the tiapp.xml [MOD-639]

v2.0.0 Upgraded to module api version 2 for 1.8.0.1

v1.0 Initial Release
v1.0.0 Initial Release
149 changes: 110 additions & 39 deletions android/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ started with using this module in your application.

## Requirements

Add this to the &lt;android /&gt; node in tiapp.xml:

<android>
<tool-api-level>14</tool-api-level>
</android>
- [x] Titanium SDK 7.0.0+
- [x] [Ti.PlayServices](https://github.com/appcelerator-modules/ti.playservices) module

## Accessing the Admob Module

To access this module from JavaScript, you would do the following (recommended):

var Admob = require('ti.admob');
```js
var Admob = require('ti.admob');
```

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

## Doubleclick for Publishers Developer Docs

<https://developers.google.com/mobile-ads-sdk/>

## Functions

### number isGooglePlayServicesAvailable()
### Number isGooglePlayServicesAvailable()

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`.

### createAdMobView({ . . . })
### `createAdMobView(args)`

Returns a view with an ad initialized by default.

Expand All @@ -51,75 +51,144 @@ parameters[object]: a dictionary object of properties.
#### Example:

var adMobView = Admob.createView({
adUnitId: "<<YOUR AD UNIT ID HERE>>",
adUnitId: 'ENTER_YOUR_AD_UNIT_ID_HERE',
testing:false, // default is false
top: 0, //optional
top: 0, // optional
left: 0, // optional
right: 0, // optional
bottom: 0 // optional
adBackgroundColor:"FF8800", // optional
backgroundColorTop: "738000", //optional - Gradient background color at top
borderColor: "#000000", // optional - Border color
textColor: "#000000", // optional - Text color
urlColor: "#00FF00", // optional - URL color
linkColor: "#0000FF" //optional - Link text color
primaryTextColor: "blue", // deprecated -- now maps to textColor
secondaryTextColor: "green" // deprecated -- now maps to linkColor
adBackgroundColor: '#FF8800', // optional
backgroundColorTop: '#738000', // optional - Gradient background color at top
borderColor: '#000000', // optional - Border color
textColor: '#000000', // optional - Text color
urlColor: '#00FF00', // optional - URL color
linkColor: '#0000FF' // optional - Link text color
});

### Admob.AD_RECEIVED
### `Admob.AD_RECEIVED`

returns the constant for AD_RECEIVED -- for use in an event listener

#### Example:

adMobView.addEventListener(Admob.AD_RECEIVED,function(){
alert("ad was just received");
adMobView.addEventListener(Admob.AD_RECEIVED, function () {
alert('ad was just received');
});

### Admob.AD_NOT_RECEIVED
### `Admob.AD_NOT_RECEIVED`

returns the constant for AD_NOT_RECEIVED -- for use in an event listener

#### Example:

adMobView.addEventListener(Admob.AD_NOT_RECEIVED,function(){
alert("ad was not received");
adMobView.addEventListener(Admob.AD_NOT_RECEIVED, function () {
alert('ad was not received');
});

### AdMobView.requestAd();
### `AdMobView.requestAd(args)`

Calls for a new ad if needed.
Calls for a new ad if needed. Pass optional `args` to configure extras.

#### Example:

adMobView.requestAd();
```js
adMobView.requestAd({
extras: {
'npa': '1' // Disable personalized ads (GDPR)
}
});
```

### AdMobView.requestTestAd();
### `AdMobView.requestTestAd()`

Calls for a test ad if needed. This works independently from the testing flag above.

#### Example:

adMobView.requestTestAd();
```js
adMobView.requestTestAd();
```

### `requestConsentInfoUpdateForPublisherIdentifiers(args)`

Requests consent information update for the provided publisher identifiers. All publisher
identifiers used in the application should be specified in this call. Consent status is reset to
unknown when the ad provider list changes.

- `publisherIdentifiers` (Array<String>)
- `callback` (Function)

### `showConsentForm(args)`

Shows a consent modal form. Arguments:

- `shouldOfferPersonalizedAds` (Boolean)
Indicates whether the consent form should show a personalized ad option. Defaults to `true`.
- `shouldOfferNonPersonalizedAds` (Boolean)
Indicates whether the consent form should show a non-personalized ad option. Defaults to `true`.
- `shouldOfferAdFree` (Boolean)
Indicates whether the consent form should show an ad-free app option. Defaults to `false`.
- `callback` (Function)
Callback to be triggered once the form completes.

### `resetConsent()`

Resets consent information to default state and clears ad providers.

### `setTagForUnderAgeOfConsent(true|false)`

Sets whether the user is tagged for under age of consent.

### `isTaggedForUnderAgeOfConsent()` (Boolean)

Indicates whether the user is tagged for under age of consent.

## Properties

### `consentStatus` (`CONSENT_STATUS_UNKNOWN`, `CONSENT_STATUS_NON_PERSONALIZED` or `CONSENT_STATUS_PERSONALIZED`)

### `adProviders` (Array)

Array of ad providers.

### `debugGeography` (`DEBUG_GEOGRAPHY_DISABLED`, `DEBUG_GEOGRAPHY_EEA` or `DEBUG_GEOGRAPHY_NOT_EEA`)

Debug geography. Used for debug devices only.

## Constants

### number SUCCESS
Returned by `isGooglePlayServicesAvailable` if the connection to Google Play services was successful.
### Number `SUCCESS`
Returned by `isGooglePlayServicesAvailable()` if the connection to Google Play Services was successful.

### number SERVICE_MISSING
Returned by `isGooglePlayServicesAvailable` if Google Play services is missing on this device.
### Number `SERVICE_MISSING`
Returned by `isGooglePlayServicesAvailable()` if Google Play Services is missing on this device.

### number SERVICE_VERSION_UPDATE_REQUIRED
Returned by `isGooglePlayServicesAvailable` if the installed version of Google Play services is out of date.
### Number `SERVICE_VERSION_UPDATE_REQUIRED`
Returned by `isGooglePlayServicesAvailable()` if the installed version of Google Play Services is out of date.

### number SERVICE_DISABLED
Returned by `isGooglePlayServicesAvailable` if the installed version of Google Play services has been disabled on this device.
### Number `SERVICE_DISABLED`
Returned by `isGooglePlayServicesAvailable()` if the installed version of Google Play Services has been disabled on this device.

### number SERVICE_INVALID
Returned by `isGooglePlayServicesAvailable` if the version of the Google Play services installed on this device is not authentic.
### Number `SERVICE_INVALID`
Returned by `isGooglePlayServicesAvailable()` if the version of the Google Play Services installed on this device is not authentic.

### Number `CONSENT_STATUS_UNKNOWN`
Returned by `consentStatus` if the consent status is unknown.

### Number `CONSENT_STATUS_NON_PERSONALIZED`
Returned by `consentStatus` if the consent status is not personalized.

### Number `CONSENT_STATUS_PERSONALIZED`
Returned by `consentStatus` if the consent status is personalized.

### Number `DEBUG_GEOGRAPHY_DISABLED`
Returned by `debugGeography` if geography debugging is disabled.

### Number `DEBUG_GEOGRAPHY_EEA`
Returned by `debugGeography` if geography appears as in EEA for debug devices.

### Number `DEBUG_GEOGRAPHY_NOT_EEA`
Returned by `debugGeography` if geography appears as not in EEA for debug devices.

## Module History

Expand All @@ -132,8 +201,10 @@ Please direct all questions, feedback, and concerns to [info@appcelerator.com](m
## Author

Brian Kurzius | bkurzius@gmail.com
Axway Appcelerator

## License
Copyright 2011, Brian Kurzius, Studio Classics.
Copyright 2014 - Present, Appcelerator.

Please see the LICENSE file included in the distribution for further details.
Binary file added android/lib/consent-library-1.0.1.aar
Binary file not shown.
Binary file added android/lib/gson-2.8.4.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# during compilation, packaging, distribution, etc.
#

version: 4.1.0
version: 4.2.0
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86
description: Titanium Admob module for Android
author: Brian Kurzius
license: Apache License, Version 2.0
copyright: Copyright (c) 2011 by Studio Classics
copyright: Copyright (c) 2011 by Studio Classics, 2017-present by Axway Appcelerator


# these should not be edited
Expand Down
Loading

0 comments on commit ed1099d

Please sign in to comment.