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

Ab test sample app #15

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ Checkout the documentation below.
- Native: [Java](https://github.com/GreedyGame/sdkone-android-samples/tree/main/java/NativeExample), [Kotlin](https://github.com/GreedyGame/sdkone-android-samples/tree/main/kotlin/NativeExample)
- RecyclerViewAdAdapter: [Java](https://github.com/GreedyGame/sdkone-android-samples/tree/main/java/RecyclerViewAdapterExample), [Kotlin](https://github.com/GreedyGame/sdkone-android-samples/tree/main/kotlin/RecyclerViewAdapterExample)


<br>

## A/B Testing between SDKOne and Admob
- [Documentation](https://drive.google.com/file/d/1DnyZNbUbO-K-mxhH5J-LSOJIML1MAOKE/view?usp=sharing)
- Sample: [Java](https://github.com/GreedyGame/sdkone-android-samples/tree/main/java/ABTestExample), [Kotlin](https://github.com/GreedyGame/sdkone-android-samples/tree/main/kotlin/ABTestExample)

<br>

# OfferWall
Expand Down
15 changes: 15 additions & 0 deletions java/ABTestExample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
1 change: 1 addition & 0 deletions java/ABTestExample/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
77 changes: 77 additions & 0 deletions java/ABTestExample/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false
id 'com.google.gms.google-services'
}

android {
namespace 'com.pubscale.sdkone.example.abtestexample'
compileSdk 33

defaultConfig {
applicationId "com.pubscale.sdkone.example.abtestexample"
minSdk 19
targetSdk 33
versionCode 1
versionName "1.0"
multiDexEnabled true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

buildFeatures {
viewBinding true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21'

//SDKOne dependency
implementation 'com.pubscale.sdkone:core:0.03'

//Dependencies required by SDKOne
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.palette:palette:1.0.0"
implementation "com.squareup.moshi:moshi:1.14.0"
implementation "com.squareup.moshi:moshi-adapters:1.14.0"
annotationProcessor("com.squareup.moshi:moshi-kotlin-codegen:1.14.0")

//This will Add the following Play service version to get ads from AdMob in the //app.gradle file. Minimum supported version for AdMob is Play Service version //20.0.0. Recommended version is 20.2.0
implementation 'com.google.android.gms:play-services-ads:22.1.0'

//Optional
implementation 'com.google.android.gms:play-services-location:21.0.1'

implementation(platform("com.google.firebase:firebase-bom:32.1.1"))
implementation("com.google.firebase:firebase-config")
implementation("com.google.firebase:firebase-analytics")

implementation project(':nativetemplates')

def lifecycle_version = "2.3.1"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
annotationProcessor("androidx.lifecycle:lifecycle-compiler:$lifecycle_version")
}
21 changes: 21 additions & 0 deletions java/ABTestExample/app/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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.pubscale.sdkone.example.abtestexample;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.pubscale.sdkone.example.abtestexample", appContext.getPackageName());
}
}
41 changes: 41 additions & 0 deletions java/ABTestExample/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name=".BaseApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ABTestExample"
tools:targetApi="31">
<activity
android:name=".SplashActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="false"/>
<activity
android:name=".DummyActivity"
android:exported="false" />
<meta-data
android:name="sdkx_app_id"
android:value="@string/sdkx_app_id" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-4073866383873410~4145783391" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.pubscale.sdkone.example.abtestexample;

import android.app.Application;

import com.google.android.gms.ads.MobileAds;
import com.google.firebase.FirebaseApp;
import com.pubscale.sdkone.example.abtestexample.utils.AppOpenAdManager;

public class BaseApplication extends Application {

@Override
public void onCreate() {
super.onCreate();
FirebaseApp.initializeApp(this);
MobileAds.initialize(this);
registerActivityLifecycleCallbacks(new AppOpenAdManager());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.pubscale.sdkone.example.abtestexample;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;

import com.pubscale.sdkone.example.abtestexample.databinding.ActivityDummyBinding;

public class DummyActivity extends AppCompatActivity {

private ActivityDummyBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityDummyBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());

binding.homeButton.setOnClickListener(view -> {
onBackPressed();
});
}
}
Loading