Skip to content

Commit

Permalink
fix: in-app messages not displaying for release builds on Android (#65)
Browse files Browse the repository at this point in the history
Co-authored-by: Shahroz Khan <[email protected]>
  • Loading branch information
levibostian and Shahroz16 authored Jul 25, 2023
1 parent 619f88b commit 1d742c2
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
with:
java-version: '12.x'
- uses: ./.github/actions/setup-flutter
- run: flutter build appbundle
- run: flutter build apk --release
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ android {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Customer.io SDK
def cioVersion = "3.6.3"
def cioVersion = "3.6.4"
implementation "io.customer.android:tracking:$cioVersion"
implementation "io.customer.android:messaging-push-fcm:$cioVersion"
implementation "io.customer.android:messaging-in-app:$cioVersion"
Expand Down
16 changes: 14 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,22 @@ android {
versionName flutterVersionName
}

signingConfigs {
debug {
storeFile file("../../debug.keystore")
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}

buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
Expand Down
8 changes: 7 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.customer.customer_io_example">

<!-- network security config set to allow proxy tools to view HTTP communication for app debugging.
tools:replace is needed because SDK declares a network security config as well for automated tests.
-->
<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:label="customer_io_example">
android:label="customer_io_example"
android:networkSecurityConfig="@xml/network_security_config"
tools:replace="android:networkSecurityConfig">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand Down
17 changes: 17 additions & 0 deletions example/android/app/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<network-security-config>
<domain-config>
<!-- using * because user might be testing against non-production endpoint -->
<domain includeSubdomains="true">*</domain>
<trust-anchors>
<certificates src="user"/>
<certificates src="system"/>
</trust-anchors>
</domain-config>

<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="user" />
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
Binary file added example/debug.keystore
Binary file not shown.
21 changes: 21 additions & 0 deletions example/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

0 comments on commit 1d742c2

Please sign in to comment.