Skip to content
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
31 changes: 17 additions & 14 deletions SampleApplication/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
compileSdk = 34
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.mparticle.branchsample"
minSdkVersion 16
targetSdkVersion 27
minSdk = 25
targetSdk = 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -19,22 +19,25 @@ android {
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
exclude 'META-INF/versions/9/module-info.class'
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.installreferrer:installreferrer:[1.0, )'

// implementation 'com.mparticle:android-branch-kit:5+'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.android.installreferrer:installreferrer:2.2'

// Local project dependency
api project(':local-mParticle-Branch-kit')

// Uncomment below to use published version instead
// implementation 'com.mparticle:android-branch-kit:5+'

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'

androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1', {
exclude group: 'androidx.test', module: 'runner'
})

api project(':local-mParticle-Branch-kit')
}
}
4 changes: 3 additions & 1 deletion SampleApplication/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<activity
android:name=".activities.SplashActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait"
Expand All @@ -32,9 +33,10 @@

<activity
android:name=".activities.HomeActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class SampleApplication extends Application implements AttributionListener {
private IBranchEvents branchEventCallback;
private static SampleApplication instance;

@Override
public void onCreate() {
super.onCreate();
Expand All @@ -30,15 +30,15 @@ public void onCreate() {
//that is passed to the Branch SDK's initSession() API.
.logLevel(MParticle.LogLevel.VERBOSE)
.build();

MParticle.start(options);
}

public static void setBranchEventCallback(IBranchEvents branchEventCallback) {
instance.branchEventCallback = branchEventCallback;
}


/**
* A few typical scenarios where this callback would be invoked:
* <p>
Expand Down Expand Up @@ -86,15 +86,15 @@ public void onResult(AttributionResult attributionResult) {
}
}
}

@Override
public void onError(AttributionError attributionError) {
//if the Branch SDK returns an error, it will be surfaced here.
if (branchEventCallback != null) {
branchEventCallback.onBranchInitialised(new JSONObject());
}
}

public interface IBranchEvents {
void onBranchInitialised(JSONObject params);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.CompoundButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;

import com.mparticle.MPEvent;
import com.mparticle.MParticle;
Expand All @@ -25,43 +25,43 @@
*/

public class SplashActivity extends AppCompatActivity implements SampleApplication.IBranchEvents {

private static final int SPLASH_DELAY = 1500;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_activity);
SampleApplication.setBranchEventCallback(this);
}

@Override
protected void onStart() {
super.onStart();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {


}
}, SPLASH_DELAY);
}

/**
* Note : Branch needs the new intents to be set to the activity if the launch mode is `SingleTask`
**/
@Override
protected void onNewIntent(Intent intent) {
this.setIntent(intent);
}

@Override
public void onBranchInitialised(JSONObject params) {
final Intent intent = new Intent(SplashActivity.this, HomeActivity.class);
if (params.optBoolean("+clicked_branch_link")) {
Map<String, String> infoMap = new HashMap<>();
infoMap.put("Referred Link", params.optString("~referring_link"));

MPEvent event = new MPEvent.Builder("Referred Session", MParticle.EventType.UserContent)
.duration(300)
.info(infoMap)
Expand All @@ -77,5 +77,5 @@ public void run() {
}
}, 1500);
}

}
2 changes: 1 addition & 1 deletion SampleApplication/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:7.4.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
3 changes: 3 additions & 0 deletions SampleApplication/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion SampleApplication/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
2 changes: 1 addition & 1 deletion SampleApplication/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include ':app'
include ':local-mParticle-Branch-kit'
project(':local-mParticle-Branch-kit').projectDir = new File(settingsDir, '../../mparticle-for-android-branch')
project(':local-mParticle-Branch-kit').projectDir = new File(settingsDir, '..')
Loading