Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add firebase integration to Example UI Android project #100

Open
wants to merge 1 commit into
base: example_ui
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions CTExample/Assets/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@
</intent-filter>
</service>

<meta-data
android:name="FCM_SENDER_ID"
android:value="id:YOUR_FCM_SENDER_ID" />

<meta-data
android:name="CLEVERTAP_ACCOUNT_ID"
android:value="Your CleverTap Account ID" />
Expand All @@ -93,6 +89,10 @@
android:name="CLEVERTAP_TOKEN"
android:value="Your CleverTap Account Token" />

<meta-data
android:name="CLEVERTAP_REGION"
android:value="Your CleverTap Account Region" />

</application>

</manifest>
14 changes: 14 additions & 0 deletions CTExample/Assets/Plugins/Android/baseProjectTemplate.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
// If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
// 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.google.gms.google-services' version '4.4.2' apply false
**BUILD_SCRIPT_DEPS**
}

task clean(type: Delete) {
delete rootProject.buildDir
}

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

65 changes: 65 additions & 0 deletions CTExample/Assets/Plugins/Android/launcherTemplate.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

dependencies {
implementation project(':unityLibrary')
implementation(platform("com.google.firebase:firebase-bom:31.0.0"))
implementation("com.google.firebase:firebase-messaging")
}

android {
namespace "**NAMESPACE**"
ndkPath "**NDKPATH**"

compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
}

aaptOptions {
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}**SIGN**

lintOptions {
abortOnError false
}

buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
}
}**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
**BUILT_APK_LOCATION**
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**
7 changes: 7 additions & 0 deletions CTExample/Assets/Plugins/Android/launcherTemplate.gradle.meta

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

1 change: 1 addition & 0 deletions CTExample/Assets/Plugins/Android/mainTemplate.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
**DEPS**}

android {
namespace "com.unity3d.player"
ndkPath "**NDKPATH**"

compileSdkVersion **APIVERSION**
Expand Down
7 changes: 7 additions & 0 deletions CTExample/Assets/Scripts/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ void Awake()
CleverTap.LaunchWithCredentials(accountId, accountToken);
}
Logger.Log($"Launching \"{accountName}\" with accountId: {accountId}, accountToken: {accountToken}, accountRegion: {accountRegion}.");

#if UNITY_ANDROID
if (!CleverTap.IsPushPermissionGranted())
{
CleverTap.PromptForPushPermission(true);
}
#endif
}
}
}
1 change: 1 addition & 0 deletions CTExample/ProjectSettings/GvhProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<projectSetting name="Google.IOSResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="Google.PackageManagerResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="Google.VersionHandler.VerboseLoggingEnabled" value="False" />
<projectSetting name="GooglePlayServices.UseJetifier" value="True" />
</projectSettings>
5 changes: 3 additions & 2 deletions CTExample/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ PlayerSettings:
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0
audioSpatialExperience: 0
deferSystemGesturesMode: 0
hideHomeButton: 0
submitAnalytics: 1
Expand Down Expand Up @@ -256,8 +257,8 @@ PlayerSettings:
useCustomMainManifest: 1
useCustomLauncherManifest: 0
useCustomMainGradleTemplate: 1
useCustomLauncherGradleManifest: 0
useCustomBaseGradleTemplate: 0
useCustomLauncherGradleManifest: 1
useCustomBaseGradleTemplate: 1
useCustomGradlePropertiesTemplate: 1
useCustomGradleSettingsTemplate: 1
useCustomProguardFile: 0
Expand Down