Skip to content

Commit dd37d18

Browse files
authored
Merge branch 'workstation/6.0-Release' into feat/braze-40-kit
Signed-off-by: denischilik <denis.chilik@rokt.com>
2 parents d9de97d + c825242 commit dd37d18

51 files changed

Lines changed: 5128 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

kits/braze/braze-41/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Braze (formerly Appboy) Kit Integration
2+
3+
This repository contains the [Braze](https://www.braze.com/) integration for the [mParticle Android SDK](https://github.com/mParticle/mparticle-android-sdk).
4+
5+
## Example App
6+
7+
This repository contains an [example app](https://github.com/mparticle-integrations/mparticle-android-integration-appboy/tree/master/example) showing how to implement mParticle, Braze, and Firebase Cloud Messaging. The key changes you need to make to your app are below, and please also reference mParticle and Braze's documentation:
8+
9+
- [Instrumenting Push](https://docs.mparticle.com/developers/sdk/android/push-notifications)
10+
- [Braze Documentation](https://docs.mparticle.com/integrations/braze/event)
11+
12+
## 1. Adding the integration
13+
14+
[See a full build.gradle example here](https://github.com/mparticle-integrations/mparticle-android-integration-appboy/blob/master/example/build.gradle)
15+
16+
1. The Braze Kit requires that you add Braze's Maven server to your buildscript:
17+
18+
```groovy
19+
repositories {
20+
maven { url "https://appboy.github.io/appboy-android-sdk/sdk" }
21+
//Braze's library depends on the Google Support Library
22+
google()
23+
...
24+
}
25+
```
26+
27+
2. Add the kit dependency to your app's `build.gradle`:
28+
29+
```groovy
30+
dependencies {
31+
implementation 'com.mparticle:braze-41:5+'
32+
}
33+
```
34+
35+
## 2. Registering for Push
36+
37+
mParticle's SDK takes care of registering for push notifications and passing tokens or instance IDs to the Braze SDK. [Follow the mParticle push notification documentation](https://docs.mparticle.com/developers/sdk/android/push-notifications#register-for-push-notifications) to instrument the SDK for push registration. You can skip over [this section of Braze's documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/android/push_notifications/integration/#registering-for-push).
38+
39+
## 3. Displaying Push
40+
41+
[See a full example of an AndroidManifest.xml here](https://github.com/mparticle-integrations/mparticle-android-integration-appboy/blob/master/example/src/main/AndroidManifest.xml).
42+
43+
mParticle's SDK also takes care of capturing incoming push notifications and passing the resulting `Intent` to Braze's `BrazePushReceiver`. Follow the [mParticle push notification documentation](https://docs.mparticle.com/developers/sdk/android/push-notifications#display-push-notifications) to ensure you add the correct services and receivers to your app's AndroidManifest.xml.
44+
45+
## 4. Reacting to Push and Deeplinking
46+
47+
There are a wide variety of implementation options available in Braze to deeplink a user when they tap a notification. There are **two specific requirements** to ensure automatic deeplinking works as intended.
48+
49+
- `BrazePushReceiver`
50+
51+
Whereas up until now you should have nothing Braze-specific in your `AndroidManifest.xml`, using Braze's automatic deeplinking does require you to add their `BrazePushReceiver`. Note that you do not need to specify any Intent filters (for example to receive push tokens, since mParticle takes care of that). You just need to add the following:
52+
53+
```xml
54+
<receiver android:name="com.braze.push.BrazePushReceiver" />
55+
```
56+
57+
- `braze.xml`
58+
59+
For automatic deep-linking, you need to add a boolean resource named `com_braze_handle_push_deep_links_automatically`. This can be in any resource file, or you can name it `braze.xml`:
60+
61+
```xml
62+
<?xml version="1.0" encoding="utf-8"?>
63+
<resources>
64+
<bool name="com_braze_handle_push_deep_links_automatically">true</bool>
65+
</resources>
66+
```
67+
68+
From here you should be able to successfully test push via Braze! Braze offers many client-side configurable options via xml resources and otherwise. Please see review the rest of [their documentation here](https://www.braze.com/docs/developer_guide/platform_integration_guides/android/push_notifications/integration/#step-3-add-deep-links) for more information.
69+
70+
## License
71+
72+
[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)

kits/braze/braze-41/build.gradle

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
buildscript {
2+
ext.kotlin_version = '2.0.20'
3+
if (!project.hasProperty('version') || project.version.equals('unspecified')) {
4+
project.version = '+'
5+
}
6+
7+
repositories {
8+
google()
9+
mavenLocal()
10+
mavenCentral()
11+
}
12+
dependencies {
13+
classpath 'com.android.tools.build:gradle:8.1.4'
14+
classpath 'com.mparticle:android-kit-plugin:' + project.version
15+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16+
}
17+
}
18+
19+
plugins {
20+
id "org.sonarqube" version "3.5.0.2730"
21+
id "org.jlleitschuh.gradle.ktlint" version "13.0.0"
22+
}
23+
24+
sonarqube {
25+
properties {
26+
property "sonar.projectKey", "mparticle-android-integration-appboy-41"
27+
property "sonar.organization", "mparticle"
28+
property "sonar.host.url", "https://sonarcloud.io"
29+
}
30+
}
31+
32+
apply plugin: 'org.jlleitschuh.gradle.ktlint'
33+
apply plugin: 'kotlin-android'
34+
apply plugin: 'com.mparticle.kit'
35+
36+
android {
37+
namespace 'com.mparticle.kits.appboy41'
38+
buildFeatures {
39+
buildConfig = true
40+
}
41+
defaultConfig {
42+
minSdkVersion 21
43+
}
44+
lint {
45+
// Workaround for lint internal crash
46+
abortOnError false
47+
// Ignore obsolete custom lint checks from older fragment library
48+
disable 'ObsoleteLintCustomCheck'
49+
}
50+
compileOptions {
51+
sourceCompatibility JavaVersion.VERSION_17
52+
targetCompatibility JavaVersion.VERSION_17
53+
}
54+
kotlinOptions {
55+
jvmTarget = '17'
56+
}
57+
testOptions {
58+
unitTests.all {
59+
jvmArgs += ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']
60+
}
61+
}
62+
}
63+
64+
repositories {
65+
mavenCentral()
66+
}
67+
68+
dependencies {
69+
compileOnly 'com.google.firebase:firebase-messaging:[10.2.1, )'
70+
api 'com.braze:android-sdk-ui:41.0.0'
71+
testImplementation files('libs/java-json.jar')
72+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# These are the proguard rules specified by the Appboy SDK's documentation
2+
3+
-dontwarn com.amazon.device.messaging.**
4+
-dontwarn bo.app.**
5+
-dontwarn com.braze.ui.**
6+
-dontwarn com.google.android.gms.**
7+
-keep class bo.app.** { *; }
8+
-keep class com.braze.** { *; }
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
*
3+
* Example app build.gradle for using mParticle + Braze + Firebase Cloud Messaging
4+
* Please see the inline comments below.
5+
*
6+
*/
7+
8+
9+
apply plugin: 'com.android.application'
10+
11+
android {
12+
compileSdk 31
13+
14+
defaultConfig {
15+
applicationId "com.mparticle.com.mparticle.kits.braze.example"
16+
minSdk 16
17+
targetSdk 31
18+
versionCode 1
19+
versionName "1.0"
20+
21+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
22+
23+
}
24+
25+
buildTypes {
26+
release {
27+
minifyEnabled false
28+
}
29+
}
30+
}
31+
32+
repositories {
33+
mavenCentral()
34+
maven { url "https://appboy.github.io/appboy-android-sdk/sdk" } //REQUIRED: Braze isn't available in jCenter or Maven Central - so you need to add their Maven Server
35+
google()
36+
}
37+
38+
buildscript {
39+
repositories {
40+
//REQUIRED: com.google.gms:google-services requires both jCenter and Google's Maven :rollseyes:
41+
mavenCentral()
42+
google()
43+
}
44+
dependencies {
45+
classpath 'com.google.gms:google-services:4.2.0' //REQUIRED for Firebase
46+
}
47+
}
48+
dependencies {
49+
implementation 'com.android.support:appcompat-v7:28.0.0'
50+
implementation 'com.android.support:support-v4:28.0.0'
51+
implementation 'com.android.support:support-media-compat:28.0.0'
52+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
53+
54+
// REQUIRED: Add the Braze (formerly Appboy) kit here
55+
// this will also pull in mParticle's Core SDK (com.mparticle:android-core) as a transitive dependency
56+
implementation 'com.mparticle:braze-41:5+'
57+
58+
// REQUIRED for Firebase
59+
implementation 'com.google.firebase:firebase-messaging:17.3.4'
60+
61+
// Not strictly required but strongly recommended so that mParticle and Braze can query for the Android Advertising ID
62+
implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'
63+
64+
}
65+
66+
apply plugin: 'com.google.gms.google-services' //REQUIRED for Firebase
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.mparticle.kits.braze.example">
4+
5+
<application
6+
android:allowBackup="false"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:name=".ExampleApplication"
12+
android:theme="@style/AppTheme">
13+
14+
<!-- This Braze receiver is necessary to react to pending Intents within push notifications -->
15+
<receiver android:name="com.braze.push.BrazePushReceiver" />
16+
17+
<!-- This mParticle receiver is necessary to register for push notification tokens -->
18+
<receiver
19+
android:name="com.mparticle.MPReceiver"
20+
android:permission="com.google.android.c2dm.permission.SEND">
21+
<intent-filter>
22+
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
23+
24+
<!-- Use your package name as the category -->
25+
<category android:name="com.mparticle.kits.braze.example" />
26+
</intent-filter>
27+
</receiver>
28+
29+
<!-- This mParticle service is necessary to listen for token-updates -->
30+
<service android:name="com.mparticle.messaging.InstanceIdService" />
31+
32+
<!-- This is the service that takes care of forwarding push registrations, receipts, and opens to Braze -->
33+
<service android:name="com.mparticle.MPService" />
34+
35+
<activity android:name=".MainActivity">
36+
<intent-filter>
37+
<action android:name="android.intent.action.MAIN" />
38+
<category android:name="android.intent.category.LAUNCHER" />
39+
</intent-filter>
40+
</activity>
41+
</application>
42+
43+
</manifest>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.mparticle.kits.braze.example;
2+
3+
import android.support.v7.app.AppCompatActivity;
4+
import android.os.Bundle;
5+
6+
public class MainActivity extends AppCompatActivity {
7+
8+
@Override
9+
protected void onCreate(Bundle savedInstanceState) {
10+
super.onCreate(savedInstanceState);
11+
setContentView(R.layout.activity_main);
12+
}
13+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportWidth="108"
6+
android:viewportHeight="108">
7+
<path
8+
android:fillType="evenOdd"
9+
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
10+
android:strokeWidth="1"
11+
android:strokeColor="#00000000">
12+
<aapt:attr name="android:fillColor">
13+
<gradient
14+
android:endX="78.5885"
15+
android:endY="90.9159"
16+
android:startX="48.7653"
17+
android:startY="61.0927"
18+
android:type="linear">
19+
<item
20+
android:color="#44000000"
21+
android:offset="0.0" />
22+
<item
23+
android:color="#00000000"
24+
android:offset="1.0" />
25+
</gradient>
26+
</aapt:attr>
27+
</path>
28+
<path
29+
android:fillColor="#FFFFFF"
30+
android:fillType="nonZero"
31+
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
32+
android:strokeWidth="1"
33+
android:strokeColor="#00000000" />
34+
</vector>

0 commit comments

Comments
 (0)