Skip to content

Commit 2c86dbb

Browse files
committed
Merge pull request #50 from adjust/development
New version v3.3.3
2 parents f44a6eb + 2c5ec63 commit 2c86dbb

File tree

12 files changed

+86
-47
lines changed

12 files changed

+86
-47
lines changed

Adjust/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ dependencies {
2121
}
2222

2323
android {
24-
buildToolsVersion '19.0.3'
25-
compileSdkVersion 19
24+
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
25+
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
2626
defaultConfig {
2727
versionCode 11
28-
versionName '3.3.2'
29-
minSdkVersion 8
30-
targetSdkVersion 19
28+
versionName '3.3.3'
29+
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
30+
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
3131
}
3232
sourceSets {
3333
main {

Adjust/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ANDROID_BUILD_MIN_SDK_VERSION=8
2+
ANDROID_BUILD_TARGET_SDK_VERSION=19
3+
ANDROID_BUILD_TOOLS_VERSION=19.1
4+
ANDROID_BUILD_SDK_VERSION=19

Adjust/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<artifactId>adjust-android</artifactId>
77
<groupId>com.adjust.sdk</groupId>
8-
<version>3.3.2</version>
8+
<version>3.3.3</version>
99
<packaging>jar</packaging>
1010
<properties>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

Adjust/src/com/adjust/sdk/ActivityHandler.java

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ public class ActivityHandler extends HandlerThread {
5353
private static final String TIME_TRAVEL = "Time travel!";
5454
private static final String ADJUST_PREFIX = "adjust_";
5555

56-
private final SessionHandler sessionHandler;
56+
private SessionHandler sessionHandler;
5757
private IPackageHandler packageHandler;
5858
private OnFinishedListener onFinishedListener;
5959
private ActivityState activityState;
60-
private final Logger logger;
60+
private Logger logger;
6161
private static ScheduledExecutorService timer;
62-
private final Context context;
62+
private Context context;
6363
private String environment;
6464
private String defaultTracker;
6565
private boolean eventBuffering;
@@ -76,17 +76,8 @@ public class ActivityHandler extends HandlerThread {
7676

7777
public ActivityHandler(Activity activity) {
7878
super(LOGTAG, MIN_PRIORITY);
79-
setDaemon(true);
80-
start();
81-
TIMER_INTERVAL = AdjustFactory.getTimerInterval();
82-
SESSION_INTERVAL = AdjustFactory.getSessionInterval();
83-
SUBSESSION_INTERVAL = AdjustFactory.getSubsessionInterval();
84-
sessionHandler = new SessionHandler(getLooper(), this);
85-
context = activity.getApplicationContext();
86-
clientSdk = Constants.CLIENT_SDK;
87-
enabled = true;
8879

89-
logger = AdjustFactory.getLogger();
80+
initActivityHandler(activity);
9081

9182
Message message = Message.obtain();
9283
message.arg1 = SessionHandler.INIT_BUNDLE;
@@ -96,8 +87,23 @@ public ActivityHandler(Activity activity) {
9687
public ActivityHandler(Activity activity, String appToken,
9788
String environment, String logLevel, boolean eventBuffering) {
9889
super(LOGTAG, MIN_PRIORITY);
90+
91+
initActivityHandler(activity);
92+
93+
this.appToken = appToken;
94+
this.environment = environment;
95+
this.eventBuffering = eventBuffering;
96+
logger.setLogLevelString(logLevel);
97+
98+
Message message = Message.obtain();
99+
message.arg1 = SessionHandler.INIT_PRESET;
100+
sessionHandler.sendMessage(message);
101+
}
102+
103+
private void initActivityHandler(Activity activity) {
99104
setDaemon(true);
100105
start();
106+
101107
TIMER_INTERVAL = AdjustFactory.getTimerInterval();
102108
SESSION_INTERVAL = AdjustFactory.getSessionInterval();
103109
SUBSESSION_INTERVAL = AdjustFactory.getSubsessionInterval();
@@ -108,14 +114,10 @@ public ActivityHandler(Activity activity, String appToken,
108114

109115
logger = AdjustFactory.getLogger();
110116

111-
this.appToken = appToken;
112-
this.environment = environment;
113-
this.eventBuffering = eventBuffering;
114-
logger.setLogLevelString(logLevel);
115-
116-
Message message = Message.obtain();
117-
message.arg1 = SessionHandler.INIT_PRESET;
118-
sessionHandler.sendMessage(message);
117+
String gpsAdid = Util.getGpsAdid(context);
118+
if (gpsAdid == null) {
119+
logger.info("Unable to get Google Play Services Advertising ID at start time");
120+
}
119121
}
120122

121123
public void setSdkPrefix(String sdkPrefx) {

Adjust/src/com/adjust/sdk/Adjust.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ public static void appWillOpenUrl(Uri url) {
161161

162162

163163
// Special appDidLaunch method used by SDK wrappers such as our Adobe Air SDK.
164-
protected static void appDidLaunch(Activity activity, String appToken, String environment, String logLevel, boolean eventBuffering) {
164+
public static void appDidLaunch(Activity activity, String appToken, String environment, String logLevel, boolean eventBuffering) {
165165
activityHandler = new ActivityHandler(activity, appToken, environment, logLevel, eventBuffering);
166166
}
167167

168168
// Special method used by SDK wrappers such as our Adobe Air SDK.
169-
protected static void setSdkPrefix(String sdkPrefix) {
169+
public static void setSdkPrefix(String sdkPrefix) {
170170
activityHandler.setSdkPrefix(sdkPrefix);
171171
}
172172

Adjust/src/com/adjust/sdk/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface Constants {
1919
int THIRTY_MINUTES = 30 * ONE_MINUTE;
2020

2121
String BASE_URL = "https://app.adjust.io";
22-
String CLIENT_SDK = "android3.3.2";
22+
String CLIENT_SDK = "android3.3.3";
2323
String LOGTAG = "Adjust";
2424

2525
String SESSION_STATE_FILENAME = "AdjustIoActivityState";

Adjust/src/com/adjust/sdk/Util.java

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.BufferedReader;
2626
import java.io.FileReader;
2727
import java.io.IOException;
28+
import java.lang.reflect.Method;
2829
import java.math.BigInteger;
2930
import java.security.MessageDigest;
3031
import java.text.SimpleDateFormat;
@@ -48,9 +49,6 @@
4849
import android.text.TextUtils;
4950
import android.util.DisplayMetrics;
5051

51-
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
52-
53-
5452
/**
5553
* Collects utility functions used by Adjust.
5654
*/
@@ -352,17 +350,36 @@ public static String dateFormat(long date) {
352350
}
353351

354352
public static String getGpsAdid(Context context) {
355-
String gpsAdid = null;
356353
try {
357-
AdvertisingIdClient.Info info = AdvertisingIdClient.getAdvertisingIdInfo(context);
358-
if (!info.isLimitAdTrackingEnabled()) {
359-
gpsAdid = info.getId();
354+
Class AdvertisingIdClientClass = Class.forName("com.google.android.gms.ads.identifier.AdvertisingIdClient");
355+
356+
Class[] cArg = new Class[1];
357+
cArg[0] = Context.class;
358+
Method getAdvertisingInfoMethod = AdvertisingIdClientClass.getMethod("getAdvertisingIdInfo", cArg);
359+
360+
Object AdvertisingInfoObject = getAdvertisingInfoMethod.invoke(null, context);
361+
362+
Class AdvertisingInfoClass = AdvertisingInfoObject.getClass();
363+
364+
Method isLimitedTrackingEnabledMethod = AdvertisingInfoClass.getMethod("isLimitAdTrackingEnabled");
365+
366+
Object isLimitedTrackingEnabledObject = isLimitedTrackingEnabledMethod.invoke(AdvertisingInfoObject);
367+
368+
Boolean isLimitedTrackingEnabled = (Boolean) isLimitedTrackingEnabledObject;
369+
370+
if (!isLimitedTrackingEnabled) {
371+
Method getIdMethod = AdvertisingInfoClass.getMethod("getId");
372+
373+
Object getIdObject = getIdMethod.invoke(AdvertisingInfoObject);
374+
375+
String gpsAdid = (String) getIdObject;
360376
}
361-
} catch (Exception e) {
362-
Logger logger = AdjustFactory.getLogger();
363-
logger.error(String.format("Error getting Google Play Services advertising ID, (%s)", e.getMessage()));
377+
}
378+
catch (Exception e) {
379+
}
380+
catch (NoClassDefFoundError ncdffe) {
364381
}
365382

366-
return gpsAdid;
383+
return null;
367384
}
368385
}

Adjust/test/src/com/adjust/sdk/test/TestActivityHandler.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.adjust.sdk.ActivityKind;
1313
import com.adjust.sdk.ActivityPackage;
1414
import com.adjust.sdk.AdjustFactory;
15+
import com.adjust.sdk.Constants;
1516
import com.adjust.sdk.Logger.LogLevel;
1617

1718
public class TestActivityHandler extends ActivityInstrumentationTestCase2<UnitTestActivity> {
@@ -92,7 +93,10 @@ public void testFirstSession() {
9293

9394
// check the Sdk version is being tested
9495
assertEquals(activityPackage.getExtendedString(),
95-
"android3.3.2", activityPackage.getClientSdk());
96+
"android3.3.3", activityPackage.getClientSdk());
97+
98+
// check the server url
99+
assertEquals(Constants.BASE_URL, "https://app.adjust.io");
96100

97101
Map<String, String> parameters = activityPackage.getParameters();
98102

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ for **each** Activity of your app:
133133
- Add the `import` statement at the top of the file.
134134
- In your Activity's `onResume` method call `Adjust.onResume`. Create the
135135
method if needed.
136-
- In your Activity's `orPause` method call `Adjust.onPause`. Create the
136+
- In your Activity's `onPause` method call `Adjust.onPause`. Create the
137137
method if needed.
138138

139139
After these steps your activity should look like this:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.2
1+
3.3.3

0 commit comments

Comments
 (0)