Skip to content

Commit

Permalink
Merge pull request #565 from adjust/v500_cleanup
Browse files Browse the repository at this point in the history
SDK v5 cleanup
  • Loading branch information
uerceg authored May 31, 2024
2 parents d745617 + 51e0113 commit 33f58e9
Show file tree
Hide file tree
Showing 21 changed files with 286 additions and 517 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 = 21
coreCompileSdkVersion = 34
coreTargetSdkVersion = 34
coreVersionName = '5.0.0'
coreVersionName = '5.0.0-SNAPSHOT'
defaultVersionCode = 1
webbridgeMinSdkVersion = 21
samsungReferrerMinSdkVersion = 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,17 @@
import com.adjust.sdk.OnAmazonAdIdReadListener;
import com.adjust.sdk.OnAttributionChangedListener;
import com.adjust.sdk.OnAttributionReadListener;
import com.adjust.sdk.OnDeeplinkResponseListener;
import com.adjust.sdk.OnDeferredDeeplinkResponseListener;
import com.adjust.sdk.OnEventTrackingFailedListener;
import com.adjust.sdk.OnEventTrackingSucceededListener;
import com.adjust.sdk.OnGooglePlayInstallReferrerReadListener;
import com.adjust.sdk.OnSessionTrackingFailedListener;
import com.adjust.sdk.OnSessionTrackingSucceededListener;

import java.util.ArrayList;
import java.util.List;

/**
* Created by pfms on 17/12/14.
*/
public class GlobalApplication extends Application {

@Override
public void onCreate() {
super.onCreate();
Expand Down Expand Up @@ -65,14 +61,6 @@ public void onFinishedEventTrackingSucceeded(AdjustEventSuccess eventSuccessResp
}
});


// Set url strategy
// List<String> urlStrategy = new ArrayList<>();
// urlStrategy.add("adjust.com");
// urlStrategy.add("adjust.cn");
// urlStrategy.add("eu.adjust.com");
// config.setUrlStrategy(urlStrategy , true, false);

// Set event failure tracking delegate.
config.setOnEventTrackingFailedListener(new OnEventTrackingFailedListener() {
@Override
Expand Down Expand Up @@ -101,7 +89,7 @@ public void onFinishedSessionTrackingFailed(AdjustSessionFailure sessionFailureR
});

// Evaluate deferred deep link to be launched.
config.setOnDeeplinkResponseListener(new OnDeeplinkResponseListener() {
config.setOnDeferredDeeplinkResponseListener(new OnDeferredDeeplinkResponseListener() {
@Override
public boolean launchReceivedDeeplink(Uri deeplink) {
Log.d("example", "Deferred deep link callback called!");
Expand All @@ -111,17 +99,8 @@ public boolean launchReceivedDeeplink(Uri deeplink) {
}
});

// Set default tracker.
// config.setDefaultTracker("{YourDefaultTracker}");

// Set process name.
// config.setProcessName("com.adjust.examples");

// Allow to send in the background.
config.setSendInBackground(true);

// Allow tracking preinstall
// config.setPreinstallTrackingEnabled(true);
config.enableSendingInBackground();

// Add session callback parameters.
Adjust.addGlobalCallbackParameter("sc_foo", "sc_bar");
Expand Down Expand Up @@ -155,96 +134,5 @@ public boolean launchReceivedDeeplink(Uri deeplink) {

// Initialise the adjust SDK.
Adjust.initSdk(config);




Adjust.getAttribution(new OnAttributionReadListener() {
@Override
public void onAttributionRead(AdjustAttribution attribution) {
Log.d("example", "Attribution callback called!");
Log.d("example", "Attribution: " + attribution.toString());
}
});

// Get the adid.
Adjust.getAdid(new OnAdidReadListener() {
@Override
public void onAdidRead(String adid) {
Log.d("example", "Adid callback called!");
Log.d("example", "Adid: " + adid);
}
});

Adjust.getGooglePlayInstallReferrer(this, new OnGooglePlayInstallReferrerReadListener() {
@Override
public void onInstallReferrerRead(GooglePlayInstallReferrerDetails referrerDetails) {
Log.d("example", "referrerApi : " + referrerDetails.toString());
}

@Override
public void onFailure(String message) {
Log.d("example", "failed : " + message);

}
});

// Register onResume and onPause events of all activities
// for applications with minSdkVersion >= 14.
registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks());

Adjust.getAmazonAdId(this, new OnAmazonAdIdReadListener() {
@Override
public void onAmazonAdIdRead(String amazonAdId) {
Log.d("example", "amazonAdId : " + amazonAdId);
}

@Override
public void onFail(String message) {
Log.d("example", "failed : " + message);
}
});

// Put the SDK in offline mode.
// Adjust.switchToOfflineMode();

// Disable the SDK
// Adjust.disable();

// Send push notification token.
// Adjust.setPushToken("token");
}

// You can use this class if your app is for Android 4.0 or higher
private static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks {
@Override
public void onActivityResumed(Activity activity) {
Adjust.onResume();
}

@Override
public void onActivityPaused(Activity activity) {
Adjust.onPause();
}

@Override
public void onActivityStopped(Activity activity) {
}

@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
}

@Override
public void onActivityDestroyed(Activity activity) {
}

@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
}

@Override
public void onActivityStarted(Activity activity) {
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
package com.adjust.examples.keyboard;

import android.app.Activity;
import android.app.Application;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustAttribution;
import com.adjust.sdk.AdjustConfig;
import com.adjust.sdk.AdjustEventFailure;
import com.adjust.sdk.AdjustEventSuccess;
import com.adjust.sdk.AdjustSessionFailure;
import com.adjust.sdk.AdjustSessionSuccess;
import com.adjust.sdk.LogLevel;
import com.adjust.sdk.OnAttributionChangedListener;
import com.adjust.sdk.OnDeeplinkResponseListener;
import com.adjust.sdk.OnDeferredDeeplinkResponseListener;
import com.adjust.sdk.OnEventTrackingFailedListener;
import com.adjust.sdk.OnEventTrackingSucceededListener;
import com.adjust.sdk.OnSessionTrackingFailedListener;
import com.adjust.sdk.OnSessionTrackingSucceededListener;
import com.adjust.sdk.AdjustSessionFailure;
import com.adjust.sdk.AdjustSessionSuccess;

/**
* Created by pfms on 17/12/14.
Expand Down Expand Up @@ -84,7 +82,7 @@ public void onFinishedSessionTrackingFailed(AdjustSessionFailure sessionFailureR
});

// Evaluate deferred deep link to be launched.
config.setOnDeeplinkResponseListener(new OnDeeplinkResponseListener() {
config.setOnDeferredDeeplinkResponseListener(new OnDeferredDeeplinkResponseListener() {
@Override
public boolean launchReceivedDeeplink(Uri deeplink) {
Log.d("example", "Deferred deep link callback called!");
Expand All @@ -101,7 +99,7 @@ public boolean launchReceivedDeeplink(Uri deeplink) {
// config.setProcessName("com.adjust.examples");

// Allow to send in the background.
config.setSendInBackground(true);
config.enableSendingInBackground();

// Add session callback parameters.
Adjust.addGlobalCallbackParameter("sc_foo", "sc_bar");
Expand Down Expand Up @@ -136,10 +134,6 @@ public boolean launchReceivedDeeplink(Uri deeplink) {
// Initialise the adjust SDK.
Adjust.initSdk(config);

// Register onResume and onPause events of all activities
// for applications with minSdkVersion >= 14.
registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks());

// Put the SDK in offline mode.
// Adjust.switchToOfflineMode();

Expand All @@ -149,37 +143,4 @@ public boolean launchReceivedDeeplink(Uri deeplink) {
// Send push notification token.
// Adjust.setPushToken("token");
}

// You can use this class if your app is for Android 4.0 or higher
private static final class AdjustLifecycleCallbacks implements ActivityLifecycleCallbacks {
@Override
public void onActivityResumed(Activity activity) {
Adjust.onResume();
}

@Override
public void onActivityPaused(Activity activity) {
Adjust.onPause();
}

@Override
public void onActivityStopped(Activity activity) {
}

@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
}

@Override
public void onActivityDestroyed(Activity activity) {
}

@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
}

@Override
public void onActivityStarted(Activity activity) {
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.adjust.examples

import android.app.Activity
import android.app.Application
import android.os.Bundle
import android.util.Log
import com.adjust.sdk.Adjust
import com.adjust.sdk.AdjustConfig
Expand Down Expand Up @@ -52,25 +50,15 @@ class GlobalApplication : Application() {
}

// Evaluate deferred deep link to be launched.
config.setOnDeeplinkResponseListener { deeplink ->
config.setOnDeferredDeeplinkResponseListener { deeplink ->
Log.d("example", "Deferred deep link callback called!")
Log.d("example", "Deep link URL: $deeplink")

true
}

// Set default tracker.
// config.setDefaultTracker("{YourDefaultTracker}");

// Set process name.
// config.setProcessName("com.adjust.examples");

// Allow to send in the background.
config.setSendInBackground(true)


// Allow tracking preinstall
// config.setPreinstallTrackingEnabled(true);
config.enableSendingInBackground()

// Add session callback parameters.
Adjust.addGlobalCallbackParameter("sc_foo", "sc_bar")
Expand Down Expand Up @@ -104,40 +92,5 @@ class GlobalApplication : Application() {

// Initialise the adjust SDK.
Adjust.initSdk(config)

// Register onResume and onPause events of all activities
// for applications with minSdkVersion >= 14.
registerActivityLifecycleCallbacks(AdjustLifecycleCallbacks())

// Put the SDK in offline mode.
// Adjust.switchToOfflineMode();

// Disable the SDK
// Adjust.disable();

// Send push notification token.
// Adjust.setPushToken("token");

}

// You can use this class if your app is for Android 4.0 or higher
private class AdjustLifecycleCallbacks : Application.ActivityLifecycleCallbacks {
override fun onActivityResumed(activity: Activity) {
Adjust.onResume()
}

override fun onActivityPaused(activity: Activity) {
Adjust.onPause()
}

override fun onActivityStopped(activity: Activity) {}

override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}

override fun onActivityDestroyed(activity: Activity) {}

override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}

override fun onActivityStarted(activity: Activity) {}
}
}
Loading

0 comments on commit 33f58e9

Please sign in to comment.