Skip to content

Commit

Permalink
Merge pull request #499 from adjust/v4283
Browse files Browse the repository at this point in the history
Version 4.28.3
  • Loading branch information
uerceg authored Jul 20, 2021
2 parents 64991ea + ca1fa18 commit 380152a
Show file tree
Hide file tree
Showing 33 changed files with 429 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Adjust/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ext {
coreMinSdkVersion = 9
coreCompileSdkVersion = 30
coreTargetSdkVersion = 30
coreVersionName = '4.28.2'
coreVersionName = '4.28.3'
defaultVersionCode = 1
webbridgeMinSdkVersion = 17

Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-core/src/main/java/com/adjust/sdk/Adjust.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private Adjust() {
*/
public static synchronized AdjustInstance getDefaultInstance() {
@SuppressWarnings("unused")
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.28.2";
String VERSION = "!SDK-VERSION-STRING!:com.adjust.sdk:adjust-android:4.28.3";

if (defaultInstance == null) {
defaultInstance = new AdjustInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface Constants {

String SCHEME = "https";
String AUTHORITY = "app.adjust.com";
String CLIENT_SDK = "android4.28.2";
String CLIENT_SDK = "android4.28.3";
String LOGTAG = "Adjust";
String REFTAG = "reftag";
String INSTALL_REFERRER = "install_referrer";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,27 @@ private void tryToGetResponse(final ResponseData responseData) {

try {
ActivityPackage activityPackage = responseData.activityPackage;
Map<String, String> activityPackageParameters =
new HashMap<>(activityPackage.getParameters());
Map<String, String> sendingParameters = responseData.sendingParameters;

String authorizationHeader = buildAndExtractAuthorizationHeader(
activityPackageParameters,
activityPackage.getActivityKind());

boolean shouldUseGET =
responseData.activityPackage.getActivityKind() == ActivityKind.ATTRIBUTION;
final String urlString;
if (shouldUseGET) {
extractEventCallbackId(activityPackage.getParameters());
extractEventCallbackId(activityPackageParameters);

urlString = generateUrlStringForGET(activityPackage, sendingParameters);
urlString = generateUrlStringForGET(activityPackage.getActivityKind(),
activityPackage.getPath(),
activityPackageParameters,
sendingParameters);
} else {
urlString = generateUrlStringForPOST(activityPackage);
urlString = generateUrlStringForPOST(activityPackage.getActivityKind(),
activityPackage.getPath());
}

final URL url = new URL(urlString);
Expand All @@ -148,18 +158,18 @@ private void tryToGetResponse(final ResponseData responseData) {
// get and apply connection options (default or for tests)
connectionOptions.applyConnectionOptions(connection, activityPackage.getClientSdk());

String authorizationHeader = buildAuthorizationHeader(activityPackage);
if (authorizationHeader != null) {
connection.setRequestProperty("Authorization", authorizationHeader);
}

if (shouldUseGET) {
dataOutputStream = configConnectionForGET(connection);
} else {
extractEventCallbackId(activityPackage.getParameters());
extractEventCallbackId(activityPackageParameters);

dataOutputStream =
configConnectionForPOST(connection, activityPackage, sendingParameters);
dataOutputStream = configConnectionForPOST(connection,
activityPackageParameters,
sendingParameters);
}

// read connection response
Expand Down Expand Up @@ -249,26 +259,28 @@ private String errorMessage(final Throwable throwable,
return Util.formatString("%s. (%s)", failureMessage, reasonString);
}

private String generateUrlStringForGET(final ActivityPackage activityPackage,
private String generateUrlStringForGET(final ActivityKind activityKind,
final String activityPackagePath,
final Map<String, String> activityPackageParameters,
final Map<String, String> sendingParameters)
throws MalformedURLException
{
String targetUrl = urlStrategy.targetUrlByActivityKind(activityPackage.getActivityKind());
String targetUrl = urlStrategy.targetUrlByActivityKind(activityKind);

// extra path, if present, has the format '/X/Y'
String urlWithPath =
urlWithExtraPathByActivityKind(activityPackage.getActivityKind(), targetUrl);
urlWithExtraPathByActivityKind(activityKind, targetUrl);

final URL urlObject = new URL(urlWithPath);
final Uri.Builder uriBuilder = new Uri.Builder();
uriBuilder.scheme(urlObject.getProtocol());
uriBuilder.encodedAuthority(urlObject.getAuthority());
uriBuilder.path(urlObject.getPath());
uriBuilder.appendPath(activityPackage.getPath());
uriBuilder.appendPath(activityPackagePath);

logger.debug("Making request to url: %s", uriBuilder.toString());

for (final Map.Entry<String, String> entry : activityPackage.getParameters().entrySet()) {
for (final Map.Entry<String, String> entry : activityPackageParameters.entrySet()) {
uriBuilder.appendQueryParameter(entry.getKey(), entry.getValue());
}

Expand All @@ -281,19 +293,20 @@ private String generateUrlStringForGET(final ActivityPackage activityPackage,
return uriBuilder.build().toString();
}

private String generateUrlStringForPOST(final ActivityPackage activityPackage)
private String generateUrlStringForPOST(final ActivityKind activityKind,
final String activityPackagePath)
{
String targetUrl =
urlStrategy.targetUrlByActivityKind(activityPackage.getActivityKind());
urlStrategy.targetUrlByActivityKind(activityKind);

// extra path, if present, has the format '/X/Y'
String urlWithPath =
urlWithExtraPathByActivityKind(activityPackage.getActivityKind(), targetUrl);
urlWithExtraPathByActivityKind(activityKind, targetUrl);


// 'targetUrl' does not end with '/', but activity package paths that are sent by POST
// do start with '/', so it's not added om between
String urlString = Util.formatString("%s%s", urlWithPath, activityPackage.getPath());
String urlString = Util.formatString("%s%s", urlWithPath, activityPackagePath);

logger.debug("Making request to url : %s", urlString);

Expand Down Expand Up @@ -322,7 +335,7 @@ private DataOutputStream configConnectionForGET(final HttpsURLConnection connect
}

private DataOutputStream configConnectionForPOST(final HttpsURLConnection connection,
final ActivityPackage activityPackage,
final Map<String, String> activityPackageParameters,
final Map<String, String> sendingParameters)
throws ProtocolException,
UnsupportedEncodingException,
Expand All @@ -339,7 +352,7 @@ private DataOutputStream configConnectionForPOST(final HttpsURLConnection connec

// build POST body
final String postBodyString = generatePOSTBodyString(
activityPackage.getParameters(),
activityPackageParameters,
sendingParameters);

if (postBodyString == null) {
Expand Down Expand Up @@ -510,9 +523,9 @@ private void parseResponse(final ResponseData responseData, final String respons
Util.getSdkPrefixPlatform(clientSdk));
}

private String buildAuthorizationHeader(final ActivityPackage activityPackage) {
Map<String, String> parameters = activityPackage.getParameters();
String activityKindString = activityPackage.getActivityKind().toString();
private String buildAndExtractAuthorizationHeader(final Map<String, String> parameters,
final ActivityKind activityKind) {
String activityKindString = activityKind.toString();

String secretId = extractSecretId(parameters);
String headersId = extractHeadersId(parameters);
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-criteo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.28.2'
// implementation 'com.adjust.sdk:adjust-android:4.28.3'
}

task adjustCriteoAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-imei/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.28.2'
// implementation 'com.adjust.sdk:adjust-android:4.28.3'
}

task adjustImeiAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-oaid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.28.2'
// implementation 'com.adjust.sdk:adjust-android:4.28.3'
}

task adjustOaidAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-sociomantic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.28.2'
// implementation 'com.adjust.sdk:adjust-android:4.28.3'
}

task adjustSociomanticAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-trademob/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.28.2'
// implementation 'com.adjust.sdk:adjust-android:4.28.3'
}

task adjustTrademobAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-webbridge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
// Add SDK via module.
compileOnly project(':sdk-core')
// Add SDK via Maven.
// implementation 'com.adjust.sdk:adjust-android:4.28.2'
// implementation 'com.adjust.sdk:adjust-android:4.28.3'
}

task adjustWebBridgeAndroidAar (type: Copy) {
Expand Down
2 changes: 1 addition & 1 deletion Adjust/sdk-plugin-webbridge/src/main/assets/adjust.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ var Adjust = {
if (this.adjustConfig) {
return this.adjustConfig.getSdkPrefix();
} else {
return 'web-bridge4.28.2';
return 'web-bridge4.28.3';
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public TestActivityPackage(ActivityPackage activityPackage) {
// default values
appToken = "123456789012";
environment = "sandbox";
clientSdk = "android4.28.2";
clientSdk = "android4.28.3";
suffix = "";
attribution = new AdjustAttribution();
playServices = true;
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Version 4.28.3 (21st July 2021)
#### Fixed
- Fixed missing authorization header in retry requests.

---

### Version 4.28.2 (11th June 2021)
#### Changed
- Added deep link URL decoding before parsing its parameters.
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
**This guide is being retired.**

This README file will be retired shortly. The SDK documentation can now be found on our help center:

* [English][en-helpcenter]
* [中文][zh-helpcenter]
* [日本語][ja-helpcenter]
* [한국어][ko-helpcenter]

## Summary

This is the Android SDK of Adjust™. You can read more about Adjust™ at [adjust.com].
Expand Down Expand Up @@ -104,14 +113,14 @@ These are the minimum required steps to integrate the Adjust SDK in your Android
If you are using Maven, add the following to your `build.gradle` file:

```gradle
implementation 'com.adjust.sdk:adjust-android:4.28.2'
implementation 'com.adjust.sdk:adjust-android:4.28.3'
implementation 'com.android.installreferrer:installreferrer:2.2'
```

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

```gradle
implementation 'com.adjust.sdk:adjust-android-webbridge:4.28.2'
implementation 'com.adjust.sdk:adjust-android-webbridge:4.28.3'
```

**Note**: The minimum supported Android API level for the web view extension is 17 (Jelly Bean).
Expand Down Expand Up @@ -2307,6 +2316,11 @@ If you want to trigger an event when the app is launched, use the `onCreate` met
[ja-readme]: doc/japanese/README.md
[ko-readme]: doc/korean/README.md

[en-helpcenter]: https://help.adjust.com/en/developer/android-sdk-documentation
[zh-helpcenter]: https://help.adjust.com/zh/developer/android-sdk-documentation
[ja-helpcenter]: https://help.adjust.com/ja/developer/android-sdk-documentation
[ko-helpcenter]: https://help.adjust.com/ko/developer/android-sdk-documentation

[example-java]: Adjust/example-app-java
[example-kotlin]: Adjust/example-app-kotlin
[example-keyboard]: Adjust/example-app-keyboard
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.28.2
4.28.3
32 changes: 30 additions & 2 deletions doc/chinese/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* [标准深度链接场景](#dl-standard)
* [延迟深度链接场景](#dl-deferred)
* [通过深度链接的再归因](#dl-reattribution)
* [链接解析](#link-resolution)

### 事件跟踪

Expand Down Expand Up @@ -102,14 +103,14 @@
如果您使用的是 Maven,请添加下行到您的 `build.gradle` 文件:

```gradle
implementation 'com.adjust.sdk:adjust-android:4.28.2'
implementation 'com.adjust.sdk:adjust-android:4.28.3'
implementation 'com.android.installreferrer:installreferrer:2.2'
```

如果您想在应用 web view 中使用 Adjust SDK,请也添加下列附加依赖项:

```gradle
implementation 'com.adjust.sdk:adjust-android-webbridge:4.28.2'
implementation 'com.adjust.sdk:adjust-android-webbridge:4.28.3'
```

**请注意:** web view 扩展支持的最低安卓 API 级别为 17 (Jelly Bean)。
Expand Down Expand Up @@ -728,6 +729,33 @@ protected void onNewIntent(Intent intent) {
Adjust.appWillOpenUrl(deeplinkUrl);
```

### <a id="link-resolution"></a>链接解析

通过电子邮件服务提供商 (ESP) 投放深度链接且需要使用自定义跟踪链接来跟踪点击时,可以使用 `AdjustLinkResolution` 类的 `resolveLink` 方法进行链接解析。这样,当用户在应用中打开深度链接时,您就能记录用户与电子邮件推广活动的互动了。

`resolveLink` 方法携带下列参数:

- `url` - 打开应用程序的深度链接
- `resolveUrlSuffixArray` - 需要解析的、已设置推广活动的自定义域名
- `adjustLinkResolutionCallback` - 将包含最终 URL 的回传

如果接收到的链接不属于 `resolveUrlSuffixArray` 中指定的任何域名,那么回传就会原样转发深度链接 URL;如果链接包含所指定的域名,那么 SDK 就会尝试解析链接,并将得出的深度链接返回至 `callback` 参数。您也可以使用 `Adjust.appWillOpenUrl` 方法,在 Adjust SDK 中针对返回的深度链接进行再归因。

> **请注意**:在尝试解析 URL 时,SDK 会自动追溯最多 10 个重定向 (redirect),并将其中最新的 URL 返回为 `回传` URL,也就是说,如果要追溯的重定向超过 10 个,那么 SDK 就会返回 **第 10 个重定向 URL**
**示例**

```java
AdjustLinkResolution.resolveLink(url,
new String[]{"example.com"},
new AdjustLinkResolution.AdjustLinkResolutionCallback() {
@Override
public void resolvedLinkCallback(Uri resolvedLink) {
Adjust.appWillOpenUrl(resolvedLink, getApplicationContext());
}
});
```

## 事件跟踪

### <a id="et-tracking"></a>事件跟踪
Expand Down
4 changes: 2 additions & 2 deletions doc/chinese/plugins/oaid.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ OAID 是由移动安全联盟 (MSA) 推出的广告 ID。所有中国国内的
如果您使用的是 Maven,请将以下 OAID 插件依赖项添加到现有 Adjust SDK 依赖项旁的 `build.gradle` 文件:

```
implementation 'com.adjust.sdk:adjust-android:4.28.2'
implementation 'com.adjust.sdk:adjust-android-oaid:4.28.2'
implementation 'com.adjust.sdk:adjust-android:4.28.3'
implementation 'com.adjust.sdk:adjust-android-oaid:4.28.3'
```

您还可以将 Adjust OAID 插件作为 JAR 文件进行添加,该文件可从我们的 [版本页面][releases] 下载。
Expand Down
30 changes: 30 additions & 0 deletions doc/chinese/sdk-to-sdk/admob.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 通过 Adjust SDK 跟踪 AdMob 广告收入

[Adjust 安卓 SDK 自述文件][android-readme]

此功能最低 SDK 版本要求:

- **Adjust SDK v4.28.0**

如果您想使用 AdMob SDK 跟踪广告收入,可以借助我们的 SDK 到 SDK 集成,将数据发送到 Adjust 后端。要做到这一点,您需要构建 Adjust 广告收入对象,其中包含想记录的信息,然后将对象发送到 `trackAdRevenue` 方法。

> 请注意:如果您对 AdMob 广告收入跟踪有任何疑问,请联系您的专属客户经理,或发送邮件至 [support@adjust.com](mailto:support@adjust.com)
### 示例

```java
rewardedAd = new RewardedAd(this, AD_UNIT_ID);
// set paid event listener
rewardedAd.setOnPaidEventListener(new OnPaidEventListener() {
@Override
public void onPaidEvent(AdValue adValue) {
// ...
// send ad revenue info to Adjust
AdjustAdRevenue adRevenue = new AdjustAdRevenue(AdjustConfig.AD_REVENUE_ADMOB);
adRevenue.setRevenue(adValue.getValueMicros() / 1000000, adValue.getCurrencyCode());
Adjust.trackAdRevenue(adRevenue);
}
}
```

[android-readme]: https://github.com/adjust/android_sdk/blob/master/doc/chinese/README.md
Loading

0 comments on commit 380152a

Please sign in to comment.