Skip to content

Commit 9c7334e

Browse files
authored
Merge pull request #6 from adjust/v4110
Version 4.11.0
2 parents 6d8f4a9 + 79b217c commit 9c7334e

37 files changed

+964
-450
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
### Version 4.11.0 (13th February 2017)
2+
#### Added
3+
- Added support for react native `0.40.0` (thanks to @philipheinser).
4+
- Added `adid` property to the attribution callback response.
5+
- Added `getIdfa` method to the `Adjust` instance to be able to obtain iOS advertising identifier (IDFA).
6+
- Added `getGoogleAdId` method to the `Adjust` instance to be able to obtain Google Play Services advertising identifier.
7+
- Added `getAdid` method to the `Adjust` instance to be able to get adid value at any time after obtaining it, not only when session/event callbacks have been triggered.
8+
- Added `getAttribution` method to the `Adjust` instance to be able to get current attribution value at any time after obtaining it, not only when an attribution callback has been triggered.
9+
- Added sending of **Amazon Fire Advertising Identifier** for Android platform.
10+
- Added possibility to set default tracker for the app by adding `adjust_config.properties` file to the `assets` folder of your Android app. Mostly meant to be used by the `Adjust Store & Pre-install Tracker Tool` (https://github.com/adjust/android_sdk/blob/master/doc/english/pre_install_tracker_tool.md).
11+
12+
#### Fixed
13+
- Now reading push token value from activity state file when sending package.
14+
- Fixed memory leak by closing network session for iOS platform.
15+
- Fixed `TARGET_OS_TV` pre-processor check for iOS platform.
16+
17+
#### Changed
18+
- Firing attribution request as soon as install has been tracked, regardless of presence of attribution callback implementation in user's app.
19+
- Saving iAd/AdSearch details to prevent sending duplicated `sdk_click` packages for iOS platform.
20+
- Updated docs.
21+
- Updated native iOS SDK to version **4.11.0**.
22+
- Updated native Android SDK to version **4.11.0**.
23+
- Native SDKs stability updates and improvements.
24+
25+
#### Native SDKs
26+
- [[email protected]][ios_sdk_v4.11.0]
27+
- [[email protected]][android_sdk_v4.11.0]
28+
29+
---
30+
131
### Version 4.10.0 (1st December 2016)
232
#### Added
333
- Initial release of the adjust SDK for React Native.
@@ -7,5 +37,7 @@
737
- [[email protected]][android_sdk_v4.10.4]
838

939
[ios_sdk_v4.10.3]: https://github.com/adjust/ios_sdk/tree/v4.10.3
40+
[ios_sdk_v4.11.0]: https://github.com/adjust/ios_sdk/tree/v4.11.0
1041

1142
[android_sdk_v4.10.4]: https://github.com/adjust/android_sdk/tree/v4.10.4
43+
[android_sdk_v4.11.0]: https://github.com/adjust/android_sdk/tree/v4.11.0

README.md

Lines changed: 149 additions & 88 deletions
Large diffs are not rendered by default.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.10.0
1+
4.11.0

android/libs/adjust-4.10.4.jar

-141 KB
Binary file not shown.

android/libs/adjust-android.jar

142 KB
Binary file not shown.

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

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,25 @@
99

1010
package com.adjust.nativemodule;
1111

12-
import com.facebook.react.bridge.*;
13-
import com.facebook.react.modules.core.*;
14-
1512
import java.util.Map;
1613
import java.util.HashMap;
1714
import java.util.Map.Entry;
1815

1916
import android.net.Uri;
20-
2117
import javax.annotation.Nullable;
2218

19+
import com.facebook.react.bridge.*;
20+
import com.facebook.react.modules.core.*;
21+
2322
import com.adjust.sdk.*;
2423

25-
public class Adjust extends ReactContextBaseJavaModule
26-
implements LifecycleEventListener,
27-
OnAttributionChangedListener,
28-
OnEventTrackingSucceededListener,
29-
OnEventTrackingFailedListener,
30-
OnSessionTrackingSucceededListener,
31-
OnSessionTrackingFailedListener,
32-
OnDeeplinkResponseListener {
24+
public class Adjust extends ReactContextBaseJavaModule implements LifecycleEventListener,
25+
OnAttributionChangedListener,
26+
OnEventTrackingSucceededListener,
27+
OnEventTrackingFailedListener,
28+
OnSessionTrackingSucceededListener,
29+
OnSessionTrackingFailedListener,
30+
OnDeeplinkResponseListener {
3331
private boolean attributionCallback;
3432
private boolean eventTrackingSucceededCallback;
3533
private boolean eventTrackingFailedCallback;
@@ -280,12 +278,6 @@ public void isEnabled(Callback callback) {
280278
callback.invoke(com.adjust.sdk.Adjust.isEnabled());
281279
}
282280

283-
@ReactMethod
284-
public void appWillOpenUrl(String strUri) {
285-
final Uri uri = Uri.parse(strUri);
286-
com.adjust.sdk.Adjust.appWillOpenUrl(uri);
287-
}
288-
289281
@ReactMethod
290282
public void setReferrer(String referrer) {
291283
com.adjust.sdk.Adjust.setReferrer(referrer);
@@ -296,6 +288,17 @@ public void setOfflineMode(Boolean enabled) {
296288
com.adjust.sdk.Adjust.setOfflineMode(enabled);
297289
}
298290

291+
@ReactMethod
292+
public void setPushToken(String token) {
293+
com.adjust.sdk.Adjust.setPushToken(token);
294+
}
295+
296+
@ReactMethod
297+
public void appWillOpenUrl(String strUri) {
298+
final Uri uri = Uri.parse(strUri);
299+
com.adjust.sdk.Adjust.appWillOpenUrl(uri);
300+
}
301+
299302
@ReactMethod
300303
public void sendFirstPackages() {
301304
com.adjust.sdk.Adjust.sendFirstPackages();
@@ -332,8 +335,28 @@ public void resetSessionPartnerParameters() {
332335
}
333336

334337
@ReactMethod
335-
public void setPushToken(String token) {
336-
com.adjust.sdk.Adjust.setPushToken(token);
338+
public void getIdfa(Callback callback) {
339+
callback.invoke("");
340+
}
341+
342+
@ReactMethod
343+
public void getGoogleAdId(final Callback callback) {
344+
com.adjust.sdk.Adjust.getGoogleAdId(getReactApplicationContext(), new com.adjust.sdk.OnDeviceIdsRead() {
345+
@Override
346+
public void onGoogleAdIdRead(String googleAdId) {
347+
callback.invoke(googleAdId);
348+
}
349+
});
350+
}
351+
352+
@ReactMethod
353+
public void getAdid(Callback callback) {
354+
callback.invoke(com.adjust.sdk.Adjust.getAdid());
355+
}
356+
357+
@ReactMethod
358+
public void getAttribution(Callback callback) {
359+
callback.invoke(AdjustUtil.attributionToMap(com.adjust.sdk.Adjust.getAttribution()));
337360
}
338361

339362
@ReactMethod

android/src/main/java/com/adjust/sdk/AdjustUtil.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ final class AdjustUtil {
3030
private static final String ATTRIBUTION_ADGROUP = "adgroup";
3131
private static final String ATTRIBUTION_CREATIVE = "creative";
3232
private static final String ATTRIBUTION_CLICK_LABEL = "clickLabel";
33+
private static final String ATTRIBUTION_ADID = "adid";
3334

3435
private static final String EVENT_SUCCESS_MESSAGE = "message";
3536
private static final String EVENT_SUCCESS_TIMESTAMP = "timestamp";
@@ -58,20 +59,29 @@ final class AdjustUtil {
5859
public static WritableMap attributionToMap(AdjustAttribution attribution) {
5960
WritableMap map = Arguments.createMap();
6061

62+
if (null == attribution) {
63+
return map;
64+
}
65+
6166
map.putString(ATTRIBUTION_TRACKER_TOKEN, null != attribution.trackerToken ? attribution.trackerToken : "");
6267
map.putString(ATTRIBUTION_TRACKER_NAME, null != attribution.trackerName ? attribution.trackerName : "");
6368
map.putString(ATTRIBUTION_NETWORK, null != attribution.network ? attribution.network : "");
6469
map.putString(ATTRIBUTION_CAMPAIGN, null != attribution.campaign ? attribution.campaign : "");
6570
map.putString(ATTRIBUTION_ADGROUP, null != attribution.adgroup ? attribution.adgroup : "");
6671
map.putString(ATTRIBUTION_CREATIVE, null != attribution.creative ? attribution.creative : "");
6772
map.putString(ATTRIBUTION_CLICK_LABEL, null != attribution.clickLabel ? attribution.clickLabel : "");
73+
map.putString(ATTRIBUTION_ADID, null != attribution.adid ? attribution.adid : "");
6874

6975
return map;
7076
}
7177

7278
public static WritableMap eventSuccessToMap(AdjustEventSuccess eventSuccess) {
7379
WritableMap map = Arguments.createMap();
7480

81+
if (null == eventSuccess) {
82+
return map;
83+
}
84+
7585
map.putString(EVENT_SUCCESS_MESSAGE, null != eventSuccess.message ? eventSuccess.message : "");
7686
map.putString(EVENT_SUCCESS_TIMESTAMP, null != eventSuccess.timestamp ? eventSuccess.timestamp : "");
7787
map.putString(EVENT_SUCCESS_ADID, null != eventSuccess.adid ? eventSuccess.adid : "");
@@ -84,6 +94,10 @@ public static WritableMap eventSuccessToMap(AdjustEventSuccess eventSuccess) {
8494
public static WritableMap eventFailureToMap(AdjustEventFailure eventFailure) {
8595
WritableMap map = Arguments.createMap();
8696

97+
if (null == eventFailure) {
98+
return map;
99+
}
100+
87101
map.putString(EVENT_FAILED_MESSAGE, null != eventFailure.message ? eventFailure.message : "");
88102
map.putString(EVENT_FAILED_TIMESTAMP, null != eventFailure.timestamp ? eventFailure.timestamp : "");
89103
map.putString(EVENT_FAILED_ADID, null != eventFailure.adid ? eventFailure.adid : "");
@@ -96,6 +110,10 @@ public static WritableMap eventFailureToMap(AdjustEventFailure eventFailure) {
96110

97111
public static WritableMap sessionSuccessToMap(AdjustSessionSuccess sessionSuccess) {
98112
WritableMap map = Arguments.createMap();
113+
114+
if (null == sessionSuccess) {
115+
return map;
116+
}
99117

100118
map.putString(SESSION_SUCCESS_MESSAGE, null != sessionSuccess.message ? sessionSuccess.message : "");
101119
map.putString(SESSION_SUCCESS_TIMESTAMP, null != sessionSuccess.timestamp ? sessionSuccess.timestamp : "");
@@ -107,6 +125,10 @@ public static WritableMap sessionSuccessToMap(AdjustSessionSuccess sessionSucces
107125

108126
public static WritableMap sessionFailureToMap(AdjustSessionFailure sessionFailure) {
109127
WritableMap map = Arguments.createMap();
128+
129+
if (null == sessionFailure) {
130+
return map;
131+
}
110132

111133
map.putString(SESSION_FAILED_MESSAGE, null != sessionFailure.message ? sessionFailure.message : "");
112134
map.putString(SESSION_FAILED_TIMESTAMP, null != sessionFailure.timestamp ? sessionFailure.timestamp : "");
@@ -120,6 +142,10 @@ public static WritableMap sessionFailureToMap(AdjustSessionFailure sessionFailur
120142
public static WritableMap deferredDeeplinkToMap(Uri uri) {
121143
WritableMap map = Arguments.createMap();
122144

145+
if (null == uri) {
146+
return map;
147+
}
148+
123149
map.putString("uri", uri.toString());
124150

125151
return map;

example/Screen1.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export default class Screen1 extends Component {
5757
console.log("Adgroup = " + attribution.adgroup);
5858
console.log("Creative = " + attribution.creative);
5959
console.log("Click label = " + attribution.clickLabel);
60+
console.log("Adid = " + attribution.adid);
6061
});
6162

6263
adjustConfig.setEventTrackingSucceededCallbackListener(function(eventSuccess) {
@@ -117,6 +118,21 @@ export default class Screen1 extends Component {
117118
// Adjust.resetSessionCallbackParameters();
118119
// Adjust.resetSessionPartnerParameters();
119120

121+
Adjust.getAttribution((attribution) => {
122+
console.log("Tracker token = " + attribution.trackerToken);
123+
console.log("Tracker name = " + attribution.trackerName);
124+
console.log("Network = " + attribution.network);
125+
console.log("Campaign = " + attribution.campaign);
126+
console.log("Adgroup = " + attribution.adgroup);
127+
console.log("Creative = " + attribution.creative);
128+
console.log("Click label = " + attribution.clickLabel);
129+
console.log("Adid = " + attribution.adid);
130+
});
131+
132+
Adjust.getAdid((adid) => {
133+
console.log("Adid = " + adid);
134+
});
135+
120136
Adjust.setPushToken("bunny_foo_foo");
121137

122138
Adjust.create(adjustConfig);
@@ -193,6 +209,18 @@ export default class Screen1 extends Component {
193209
_onPress_trackSimpleEvent() {
194210
Adjust.isEnabled((isEnabled) => {
195211
if (isEnabled) {
212+
Adjust.getAdid((adid) => {
213+
console.log("Adid = " + adid);
214+
});
215+
216+
Adjust.getIdfa((idfa) => {
217+
console.log("IDFA = " + idfa);
218+
});
219+
220+
Adjust.getGoogleAdId((googleAdId) => {
221+
console.log("Google Ad Id = " + googleAdId);
222+
});
223+
196224
var adjustEvent = new AdjustEvent("g3mfiw");
197225
Adjust.trackEvent(adjustEvent);
198226
} else {
@@ -204,6 +232,17 @@ export default class Screen1 extends Component {
204232
_onPress_trackRevenueEvent() {
205233
Adjust.isEnabled((isEnabled) => {
206234
if (isEnabled) {
235+
Adjust.getAttribution((attribution) => {
236+
console.log("Tracker token = " + attribution.trackerToken);
237+
console.log("Tracker name = " + attribution.trackerName);
238+
console.log("Network = " + attribution.network);
239+
console.log("Campaign = " + attribution.campaign);
240+
console.log("Adgroup = " + attribution.adgroup);
241+
console.log("Creative = " + attribution.creative);
242+
console.log("Click label = " + attribution.clickLabel);
243+
console.log("Adid = " + attribution.adid);
244+
});
245+
207246
var adjustEvent = new AdjustEvent("a4fd35");
208247
adjustEvent.setRevenue(10.0, "USD");
209248
Adjust.trackEvent(adjustEvent);

example/index.ios.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default class Example extends Component {
5656
console.log("Adgroup = " + attribution.adgroup);
5757
console.log("Creative = " + attribution.creative);
5858
console.log("Click label = " + attribution.clickLabel);
59+
console.log("Adid = " + attribution.adid);
5960
});
6061

6162
adjustConfig.setEventTrackingSucceededCallbackListener(function(eventSuccess) {
@@ -116,6 +117,21 @@ export default class Example extends Component {
116117
// Adjust.resetSessionCallbackParameters();
117118
// Adjust.resetSessionPartnerParameters();
118119

120+
Adjust.getAttribution((attribution) => {
121+
console.log("Tracker token = " + attribution.trackerToken);
122+
console.log("Tracker name = " + attribution.trackerName);
123+
console.log("Network = " + attribution.network);
124+
console.log("Campaign = " + attribution.campaign);
125+
console.log("Adgroup = " + attribution.adgroup);
126+
console.log("Creative = " + attribution.creative);
127+
console.log("Click label = " + attribution.clickLabel);
128+
console.log("Adid = " + attribution.adid);
129+
});
130+
131+
Adjust.getAdid((adid) => {
132+
console.log("Adid = " + adid);
133+
});
134+
119135
Adjust.setPushToken("bunny_foo_foo");
120136

121137
Adjust.create(adjustConfig);
@@ -186,6 +202,18 @@ export default class Example extends Component {
186202
_onPress_trackSimpleEvent() {
187203
Adjust.isEnabled((isEnabled) => {
188204
if (isEnabled) {
205+
Adjust.getAdid((adid) => {
206+
console.log("Adid = " + adid);
207+
});
208+
209+
Adjust.getIdfa((idfa) => {
210+
console.log("IDFA = " + idfa);
211+
});
212+
213+
Adjust.getGoogleAdId((googleAdId) => {
214+
console.log("Google Ad Id = " + googleAdId);
215+
});
216+
189217
var adjustEvent = new AdjustEvent("g3mfiw");
190218
Adjust.trackEvent(adjustEvent);
191219
} else {
@@ -197,6 +225,17 @@ export default class Example extends Component {
197225
_onPress_trackRevenueEvent() {
198226
Adjust.isEnabled((isEnabled) => {
199227
if (isEnabled) {
228+
Adjust.getAttribution((attribution) => {
229+
console.log("Tracker token = " + attribution.trackerToken);
230+
console.log("Tracker name = " + attribution.trackerName);
231+
console.log("Network = " + attribution.network);
232+
console.log("Campaign = " + attribution.campaign);
233+
console.log("Adgroup = " + attribution.adgroup);
234+
console.log("Creative = " + attribution.creative);
235+
console.log("Click label = " + attribution.clickLabel);
236+
console.log("Adid = " + attribution.adid);
237+
});
238+
200239
var adjustEvent = new AdjustEvent("a4fd35");
201240
adjustEvent.setRevenue(10.0, "USD");
202241
Adjust.trackEvent(adjustEvent);
@@ -261,7 +300,7 @@ export default class Example extends Component {
261300

262301
_onPress_isSdkEnabled() {
263302
Adjust.isEnabled( (isEnabled) => {
264-
if(isEnabled) {
303+
if (isEnabled) {
265304
console.log(">>> SDK is enabled");
266305
} else {
267306
console.log(">>> SDK is disabled");

ext/Android/build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
# - Copy the JAR file to the root dir
77

88
# End script if one of the lines fails
9-
#set -e
9+
# set -e
1010

1111
# Get the current directory (ext/android/)
1212
SDK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
13+
1314
# Traverse up to get to the root directory
1415
SDK_DIR="$(dirname "$SDK_DIR")"
1516
SDK_DIR="$(dirname "$SDK_DIR")"
@@ -30,4 +31,4 @@ echo -e "${GREEN}>>> Running Gradle tasks: clean clearJar makeJar ${NC}"
3031

3132
echo -e "${GREEN}>>> Moving the jar from ${JAR_IN_DIR} to ${JAR_OUT_DIR} ${NC}"
3233
mkdir ${SDK_DIR}/${JAR_OUT_DIR}
33-
mv -v ${JAR_IN_DIR}/*.jar ${SDK_DIR}/${JAR_OUT_DIR}/
34+
mv -v ${JAR_IN_DIR}/*.jar ${SDK_DIR}/${JAR_OUT_DIR}/adjust-android.jar

ext/Android/sdk

Submodule sdk updated 54 files

0 commit comments

Comments
 (0)