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
14 changes: 10 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "com.apptentive.androidexample.mparticle"
minSdkVersion 19
targetSdkVersion 30
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand All @@ -16,14 +16,20 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.mparticle:android-core:5+'
implementation 'com.mparticle:android-apptentive-kit:5+'
Copy link
Author

@PoornimaApptentive PoornimaApptentive Mar 3, 2023

Choose a reason for hiding this comment

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

kit version is temporary, will update after the release.

implementation 'com.mparticle:android-apptentive-kit:6.0.10'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
package com.apptentive.androidexample.mparticle;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import com.apptentive.android.sdk.Apptentive;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.navigation.NavigationView;
import com.mparticle.MPEvent;
import com.mparticle.MParticle;
import com.mparticle.kits.ApptentiveKitUtils;

import apptentive.com.android.feedback.Apptentive;
import apptentive.com.android.feedback.ApptentiveActivityInfo;

public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
implements NavigationView.OnNavigationItemSelectedListener, ApptentiveActivityInfo {

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -44,6 +49,11 @@ public void onClick(View view) {
navigationView.setNavigationItemSelectedListener(this);
}

@Override
public void onResume() {
super.onResume();
ApptentiveKitUtils.registerApptentiveActivityContext(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
Expand Down Expand Up @@ -95,7 +105,7 @@ public boolean onNavigationItemSelected(MenuItem item) {
} else if (id == R.id.nav_send) {
logEvent("nav_send", MParticle.EventType.Navigation);
if (MParticle.getInstance().isKitActive(MParticle.ServiceProviders.APPTENTIVE)) {
Apptentive.showMessageCenter(this);
Apptentive.showMessageCenter();
}
}

Expand All @@ -109,4 +119,10 @@ private void logEvent(String name, MParticle.EventType eventType) {
MParticle.getInstance().logEvent(event);

}

@NonNull
@Override
public Activity getApptentiveActivityInfo() {
return this;
}
}
6 changes: 3 additions & 3 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand All @@ -13,8 +13,8 @@
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />

</resources>
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
buildscript {

repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'

classpath 'com.android.tools.build:gradle:7.0.4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -17,11 +17,13 @@ buildscript {

allprojects {
repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
}
}


task clean(type: Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion 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-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip