Skip to content

Commit

Permalink
Merge pull request #7 from adtrace/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
namini40 authored Sep 12, 2022
2 parents 931598a + 184fabc commit fe493d2
Show file tree
Hide file tree
Showing 100 changed files with 991 additions and 587 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
.externalNativeBuild
.cxx
local.properties
gradle.properties
/android-sdk/gradle.properties
/android-sdk-plugin-oaid/gradle.properties
/android-sdk-plugin-webbridge/gradle.properties
Expand Down
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

7 changes: 6 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ These are the minimum required steps to integrate the AdTrace SDK in your Androi
If you are using Maven, add the following to your `build.gradle` file:

```java
implementation 'io.adtrace:android-sdk:2.1.0'
implementation 'io.adtrace:android-sdk:2.3.0'
implementation 'com.android.installreferrer:installreferrer:2.2'
```

If you would prefer to use the AdTrace SDK inside web views in your app, please include this additional dependency as well:

```java
implementation 'io.adtrace:android-sdk-plugin-webbridge:2.1.1'
implementation 'io.adtrace:android-sdk-plugin-webbridge:2.3.0'
```

**Note**: The minimum supported Android API level for the web view extension is 17 (Jelly Bean).
Expand Down Expand Up @@ -149,15 +149,23 @@ If you are **not targeting the Google Play Store**, you must also add the follow

#### <a id="gps-adid-permission"></a>Add permission to gather Google advertising ID

If you are targeting Android 12 and above (API level 31), you need to add the `com.google.android.gms.AD_ID` permission to read the device's advertising ID. Add the following line to your `AndroidManifest.xml` to enable the permission.

If you are targeting Android 12 and above (API level 31), you need to add the `com.google.android.gms.AD_ID` permission to read the device's advertising ID.
```xml
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
```
this permission is neccessary for attribution (tracking where an install is coming from) systems and it is a MUST for AdTrace SDK to work fine on android devices.
from AdTrace Android SDK `V2.2 +` this feature is **built inside the SDK** and there is no need to manually addded it to your project. however in those cases where you do *not* want to use this permission you can simply add the following.

```xml
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
```

Add this to your `AndroidManifest.xml` to disable the permission.

For more information, see [Google's `AdvertisingIdClient.Info` documentation](https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient.Info#public-string-getid).



### <a id="qs-proguard"></a>Proguard settings

If you are using Proguard, add these lines to your Proguard file:
Expand Down
4 changes: 3 additions & 1 deletion android-sdk-plugin-oaid/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/build
/build
local.properties
gradle.properties
161 changes: 146 additions & 15 deletions android-sdk-plugin-oaid/build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,166 @@
plugins {
id 'com.android.library'
id 'com.vanniktech.maven.publish'

}

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'signing'

android {
compileSdkVersion rootProject.ext.coreCompileSdkVersion

defaultConfig {
minSdkVersion rootProject.ext.coreMinSdkVersion
targetSdkVersion rootProject.ext.coreTargetSdkVersion
versionName rootProject.ext.coreVersionName
versionCode rootProject.ext.defaultVersionCode
}
lintOptions {
abortOnError false
}


}

dependencies {
compileOnly files('libs/oaid_sdk_1.1.0.aar')
// Add SDK via module.
compileOnly project(':android-sdk')
// Add SDK via Maven.
// implementation 'io.adtrace:android-sdk:2.3.0'
}

// read local properties
File localPropsFile = project.rootProject.file('local.properties')
if (localPropsFile.exists()) {
Properties p = new Properties()
new FileInputStream(localPropsFile).withCloseable { is ->
p.load(is)
}
p.each { name, value ->
ext[name] = value
}
}

task adtraceOaidAndroidAar (type: Copy) {
dependsOn 'assembleRelease'

from('build/outputs/aar/')
include 'sdk-plugin-oaid-release.aar'
destinationDir file('build/libs/')
rename 'sdk-plugin-oaid-release.aar', "${project.name}.aar"

}

task adtraceOaidAndroidJar(type: Jar) {
dependsOn 'packageReleaseAssets'
dependsOn 'compileReleaseJavaWithJavac'

from('build/intermediates/library_assets/release/packageReleaseAssets/out/') {
into('assets')
}
from('build/intermediates/javac/release/classes/')

archiveName "${project.name}.jar"
}

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
classpath += variant.javaCompileProvider.get().classpath
}
}
}

task adtraceOaidAndroidJavadocsJar(type: Jar) {
dependsOn 'androidJavadocs'
classifier = 'javadoc'
from androidJavadocs.destinationDir
}

task adtraceOaidAndroidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

artifacts {
archives adtraceOaidAndroidJar
archives adtraceOaidAndroidJavadocsJar
archives adtraceOaidAndroidSourcesJar
}

publishing {
publications {
mavenAndroidOaid(MavenPublication) {
customizePom(pom)
groupId rootProject.ext.adtraceGroupId
artifactId 'android-sdk-plugin-oaid'
version rootProject.ext.coreVersionName

artifact adtraceOaidAndroidJar
artifact adtraceOaidAndroidJavadocsJar
artifact adtraceOaidAndroidSourcesJar
}
}

repositories {
maven {
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
if (project.hasProperty("sonatypeUsername")) {
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}
}
}

def customizePom(pom) {
pom.withXml {
def root = asNode()

// Add all items necessary for maven central publication.
root.children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
description 'The AdTrace SDK for Android'
name 'AdTrace Android SDK'
url 'https://github.com/adtrace/adtrace_sdk_android'
organization {
name 'adtrace'
url 'https://www.adtrace.io'
}
licenses {
license {
name 'MIT License'
url 'http://www.opensource.org/licenses/mit-license.php'
}
}
scm {
url '[email protected]:adtrace/adtrace_sdk_android.git'
connection 'scm:git:[email protected]:adtrace/adtrace_sdk_android.git'
developerConnection 'scm:git:[email protected]:adtrace/adtrace_sdk_android.git'
}
developers {
developer {
name 'Nasser Amini'
email '[email protected]'
}
}
}
}
}
}

model {
tasks.generatePomFileForMavenAndroidOaidPublication {
destination = file("${project.buildDir}/generated-pom.xml")
}
/* TODO check if/how to replace this tasks
tasks.publishMavenAndroidOaidPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishMavenAndroidOaidPublicationToMavenRepository {
dependsOn project.tasks.signArchives
}
*/
}



signing {
sign configurations.archives
sign publishing.publications.mavenAndroidOaid
}
Binary file removed android-sdk-plugin-oaid/libs/oaid_sdk_1.0.26.aar
Binary file not shown.
3 changes: 2 additions & 1 deletion android-sdk-plugin-oaid/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class com.bun.miitmdid.core.** {*;}
-keep class com.bun.miitmdid.** {*;}
-keep interface com.bun.supplier.** {*;}
4 changes: 2 additions & 2 deletions android-sdk-plugin-oaid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.adtrace.sdk.oaid"/>

package="io.adtrace.sdk.oaid">
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static void readOaid(Context context) {
readOaid();

try {
System.loadLibrary("nllvm1623827671");
System.loadLibrary("msaoaidsec");
String certificate = Util.readCertFromAssetFile(context);
isMsaSdkAvailable = MdidSdkHelper.InitCert(context, certificate);
} catch (Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;


import io.adtrace.sdk.ILogger;
import com.bun.miitmdid.core.InfoCode;
import com.bun.miitmdid.core.MdidSdkHelper;
import com.bun.miitmdid.interfaces.IIdentifierListener;
Expand All @@ -12,8 +12,6 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

import io.adtrace.sdk.ILogger;

public class MsaSdkClient {
public static String getOaid(Context context, final ILogger logger, long maxWaitTimeInMilli) {
final BlockingQueue<String> oaidHolder = new LinkedBlockingQueue<String>(1);
Expand Down Expand Up @@ -72,4 +70,4 @@ private static boolean isError(int result, ILogger logger) {
return false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,5 @@ private void set(IBinder service) {
logger.debug("Fail to add in queue %s", e.getMessage());
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
package io.adtrace.sdk.oaid;


/**
* Important: Please do not revise the order of the method in this AIDL file
*/
Expand Down Expand Up @@ -133,4 +132,4 @@ public boolean isOaidTrackLimited() throws android.os.RemoteException {
* Obtain limit ad tracking parameter, true: limit tracking; false: do not limit tracking
*/
public boolean isOaidTrackLimited() throws android.os.RemoteException;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.adtrace.sdk.oaid;


import android.content.Context;
import android.util.Log;

Expand Down Expand Up @@ -110,4 +109,4 @@ public static String readCertFromAssetFile(Context context) {
return "";
}
}
}
}
4 changes: 3 additions & 1 deletion android-sdk-plugin-webbridge/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/build
/build
local.properties
gradle.properties
Loading

0 comments on commit fe493d2

Please sign in to comment.