Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CTExample/Assets/Plugins/Android/baseProjectTemplate.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
// See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
// See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
// To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'com.android.application' version '8.6.0' apply false
id 'com.android.library' version '8.6.0' apply false
id 'com.google.gms.google-services' version '4.4.2' apply false
**BUILD_SCRIPT_DEPS**
}
Expand Down
1 change: 1 addition & 0 deletions CTExample/Assets/Plugins/Android/launcherTemplate.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies {
android {
namespace "**NAMESPACE**"
ndkPath "**NDKPATH**"
ndkVersion '23.1.7779620'

compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
Expand Down
1 change: 1 addition & 0 deletions CTExample/Assets/Plugins/Android/mainTemplate.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies {
android {
namespace "com.unity3d.player"
ndkPath "**NDKPATH**"
ndkVersion '23.1.7779620'

compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
Expand Down
40 changes: 40 additions & 0 deletions CleverTap/Editor/AndroidReplaceGradleVersionPostProcessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#if UNITY_ANDROID && UNITY_EDITOR
using System.IO;
using UnityEditor.Android;
using UnityEngine;

namespace CleverTapSDK.Private
{
public class AndroidReplaceGradleVersionPostProcessor : IPostGenerateGradleAndroidProject
{
public int callbackOrder => 1;

public void OnPostGenerateGradleAndroidProject(string path)
{
ReplaceGradleWrapperVersion(path);
}

private static void ReplaceGradleWrapperVersion(string unityLibraryPath)
{
var gradleWrapperPath = Path.Combine(unityLibraryPath, "../gradle/wrapper/gradle-wrapper.properties");
if (!File.Exists(gradleWrapperPath))
{
Debug.LogError($"Gradle wrapper file not found at {gradleWrapperPath}");
return;
}

var lines = File.ReadAllLines(gradleWrapperPath);
for (int i = 0; i < lines.Length; i++)
{
if (lines[i].StartsWith("distributionUrl"))
{
lines[i] = "distributionUrl=https\\://services.gradle.org/distributions/gradle-8.7-bin.zip";
Debug.Log($"Updated Gradle wrapper version to 8.7 in {gradleWrapperPath}");
break;
}
}
File.WriteAllLines(gradleWrapperPath, lines);
}
}
}
#endif

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

Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ ext {
artifact = 'clevertap-android-wrapper'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to this file would be part of the latest CT Unity SDK

libraryDescription = 'The CleverTap Android Wrapper for Unity SDK'

mindSdkVersionVal = 19
compileSdkVersionVal = 34
mindSdkVersionVal = 21
compileSdkVersionVal = 35
targetSdkVersionVal = compileSdkVersionVal
buildToolsVersionVal = "34.0.0"


libraryVersion = "3.1.0"
}

android {
compileSdkVersion compileSdkVersionVal
buildToolsVersion buildToolsVersionVal
namespace "com.clevertap.unity"

defaultConfig {
minSdkVersion mindSdkVersionVal
Expand Down Expand Up @@ -45,7 +45,7 @@ repositories {
dependencies {
compileOnly fileTree('libs')

api 'com.clevertap.android:clevertap-android-sdk:7.1.2'
implementation 'com.google.firebase:firebase-messaging:23.0.6'
implementation 'androidx.core:core:1.9.0'
api 'com.clevertap.android:clevertap-android-sdk:7.4.0'
implementation 'com.google.firebase:firebase-messaging:24.0.0'
implementation 'androidx.core:core:1.13.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,6 @@ public void onCallbackAdded(String callbackName) {
CleverTapMessageSender.getInstance().flushBuffer(callback);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to this file would be part of the latest CT Unity SDK

}

public void setPushToken(String token, String region, String type) {
if (PushConstants.PushType.valueOf(type.toLowerCase()).equals(PushConstants.PushType.FCM)) {
clevertap.pushFcmRegistrationId(token, true);
} else if (PushConstants.PushType.valueOf(type.toLowerCase()).equals(PushConstants.PushType.BPS)) {
clevertap.pushBaiduRegistrationId(token, true);
} else if (PushConstants.PushType.valueOf(type.toLowerCase()).equals(PushConstants.PushType.HPS)) {
clevertap.pushHuaweiRegistrationId(token, true);
}
}

public void setOptOut(boolean value) {
try {
clevertap.setOptOut(value);
Expand Down