├── .gitignore ├── .gitmodules ├── .travis.yml ├── LICENSE ├── README.md ├── banner ├── .gitignore ├── README.md ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── flurry │ │ └── sample │ │ └── banner │ │ ├── BannerSampleApplication.java │ │ └── MainActivity.java │ └── res │ ├── layout │ └── activity_main.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── interstitial ├── .gitignore ├── README.md ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── flurry │ │ └── sample │ │ └── interstitial │ │ ├── InterstitialOnExitActivity.java │ │ ├── InterstitialSampleApplication.java │ │ └── MainActivity.java │ └── res │ ├── layout │ ├── activity_interstitial_on_exit.xml │ └── activity_main.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── mopub ├── .gitignore ├── README.md ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ ├── flurry │ │ └── sample │ │ │ └── mopub │ │ │ ├── MainActivity.java │ │ │ ├── MopubNativeActivity.java │ │ │ └── MopubSampleApplication.java │ │ └── mopub │ │ ├── mobileads │ │ ├── FlurryAgentWrapper.java │ │ ├── FlurryCustomEventBanner.java │ │ └── FlurryCustomEventInterstitial.java │ │ └── nativeads │ │ ├── FlurryCustomEventNative.java │ │ └── FlurryStaticNativeAd.java │ └── res │ ├── layout │ ├── activity_banner_ads.xml │ ├── activity_main.xml │ ├── activity_native_ads.xml │ └── list_item_native_ads.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── native ├── .gitignore ├── README.md ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── flurry │ │ └── sample │ │ └── gemini │ │ ├── BaseAdFragment.java │ │ ├── MainActivity.java │ │ ├── NativeAdChooserFragment.java │ │ ├── SingleAdFragment.java │ │ ├── StreamApplication.java │ │ ├── StreamListViewFragment.java │ │ └── entities │ │ └── NewsArticle.java │ └── res │ ├── drawable │ └── scrim_gradient_bottom_dark.xml │ ├── layout │ ├── activity_single_pane.xml │ ├── fragment_main_stream.xml │ ├── fragment_single_ad.xml │ ├── list_item_ad.xml │ └── list_item_article.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── arrays.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | *.iml 6 | .idea/ 7 | 8 | # Files for the Dalvik VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | 18 | # Gradle files 19 | .gradle/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | 28 | .DS_Store 29 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "StreamAds-Android"] 2 | path = StreamAds-Android 3 | url = git@github.com:flurry/StreamAds-Android.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Yahoo Inc. 2 | 3 | # This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 4 | 5 | # Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 6 | 7 | # 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 8 | # 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 9 | # 3. This notice may not be removed or altered from any source distribution. 10 | 11 | git: 12 | submodules: false 13 | 14 | before_install: 15 | - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules 16 | - git submodule update --init --recursive 17 | 18 | language: android 19 | 20 | android: 21 | components: 22 | - tools 23 | - platform-tools 24 | - build-tools-23.0.2 25 | - android-23 26 | - extra-android-m2repository 27 | - extra-google-m2repository 28 | 29 | script: ./gradlew build 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015 Yahoo Inc. 2 | 3 | This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. 4 | 5 | Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 6 | 7 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 8 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 9 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/flurry/android-AdIntegrationSamples.svg?branch=master)](https://travis-ci.org/flurry/android-AdIntegrationSamples) 2 | 3 | Android Ad Integration Sample 4 | ============================ 5 | 6 | Detailed integration instructions are available on [Flurry Getting Started](https://developer.yahoo.com/flurry/docs/analytics/gettingstarted/android/) 7 | and [Flurry Android Publisher](https://developer.yahoo.com/flurry/docs/publisher/code/android/) pages. 8 | 9 | This sample shows a number of modules that integrate various ad types from Flurry. All you need to get started is to put in your ad space and API key where necessary. 10 | 11 | When cloning this repo please use the following: 12 | git clone --recursive git@github.com:flurry/android-AdIntegrationSamples.git 13 | 14 | For further help and information, please check out the [Flurry Documentations](https://developer.yahoo.com/flurry) or contact [Flurry Support](mailto:support@flurry.com). 15 | 16 | ## Copyright 17 | 18 | Copyright 2015 Yahoo Inc. 19 | Licensed under the terms of the zLib license. Please see LICENSE file for terms. 20 | -------------------------------------------------------------------------------- /banner/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /banner/README.md: -------------------------------------------------------------------------------- 1 | Flurry Banner Ad Integration 2 | ========================= 3 | 4 | This module shows how to integrate a standard banner into your apps using Flurry. 5 | 6 | To run this sample, put in your API key into `BannerSampleApplication` and your banner ad space name 7 | into `MainActivity`. -------------------------------------------------------------------------------- /banner/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.flurry.sample.banner" 9 | minSdkVersion 10 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile 'com.google.android.gms:play-services-basement:8.4.0' 24 | compile 'com.android.support:appcompat-v7:23.1.1' 25 | compile 'com.android.support:support-v4:23.1.1' 26 | compile 'com.flurry.android:ads:6.2.0' 27 | } 28 | -------------------------------------------------------------------------------- /banner/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add any project specific keep options here: 2 | 3 | # If your project uses WebView with JS, uncomment the following 4 | # and specify the fully qualified class name to the JavaScript interface 5 | # class: 6 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 7 | # public *; 8 | #} 9 | -------------------------------------------------------------------------------- /banner/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /banner/src/main/java/com/flurry/sample/banner/BannerSampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.flurry.sample.banner; 2 | 3 | import android.app.Application; 4 | import android.util.Log; 5 | 6 | import com.flurry.android.FlurryAgent; 7 | 8 | public class BannerSampleApplication extends Application { 9 | private final static String TAG = BannerSampleApplication.class.getSimpleName(); 10 | 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | FlurryAgent.setLogEnabled(false); 15 | FlurryAgent.setLogLevel(Log.VERBOSE); 16 | FlurryAgent.setLogEvents(true); 17 | FlurryAgent.init(this, "JQVT87W7TGN5W7SWY2FH"); 18 | Log.i(TAG, "Flurry SDK initialized"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /banner/src/main/java/com/flurry/sample/banner/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.flurry.sample.banner; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.util.Log; 6 | import android.view.Menu; 7 | import android.view.MenuItem; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.flurry.android.ads.FlurryAdBanner; 12 | import com.flurry.android.ads.FlurryAdBannerListener; 13 | import com.flurry.android.ads.FlurryAdErrorType; 14 | 15 | public class MainActivity extends AppCompatActivity { 16 | 17 | public static final String STATE_PERSIST_STANDARD = "com.flurry.sample.banner.persiststandard"; 18 | private FlurryAdBanner mFlurryAdStandardBanner = null; 19 | private final static String TAG = MainActivity.class.getSimpleName(); 20 | private boolean mShouldRestoreStandardBanner; 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_main); 26 | 27 | if (savedInstanceState != null) { 28 | mShouldRestoreStandardBanner = savedInstanceState 29 | .getBoolean(STATE_PERSIST_STANDARD, false); 30 | 31 | if (mShouldRestoreStandardBanner) { 32 | loadStandardBanner(); 33 | } 34 | } 35 | 36 | findViewById(R.id.standard_ad_btn).setOnClickListener(new View.OnClickListener() { 37 | @Override 38 | public void onClick(View v) { 39 | mShouldRestoreStandardBanner = true; 40 | 41 | if (mFlurryAdStandardBanner != null) { 42 | mFlurryAdStandardBanner.destroy(); 43 | ((ViewGroup) findViewById(R.id.banner_layout)).removeAllViews(); 44 | } 45 | loadStandardBanner(); 46 | } 47 | }); 48 | } 49 | 50 | @Override 51 | public void onSaveInstanceState(Bundle outState) { 52 | outState.putBoolean(STATE_PERSIST_STANDARD, mShouldRestoreStandardBanner); 53 | super.onSaveInstanceState(outState); 54 | } 55 | 56 | @Override 57 | protected void onStop() { 58 | if (mFlurryAdStandardBanner != null) { 59 | mFlurryAdStandardBanner.destroy(); 60 | } 61 | 62 | super.onStop(); 63 | } 64 | 65 | @Override 66 | public boolean onCreateOptionsMenu(Menu menu) { 67 | // Inflate the menu; this adds items to the action bar if it is present. 68 | getMenuInflater().inflate(R.menu.menu_main, menu); 69 | return true; 70 | } 71 | 72 | @Override 73 | public boolean onOptionsItemSelected(MenuItem item) { 74 | // Handle action bar item clicks here. The action bar will 75 | // automatically handle clicks on the Home/Up button, so long 76 | // as you specify a parent activity in AndroidManifest.xml. 77 | int id = item.getItemId(); 78 | 79 | //noinspection SimplifiableIfStatement 80 | if (id == R.id.action_settings) { 81 | return true; 82 | } 83 | 84 | return super.onOptionsItemSelected(item); 85 | } 86 | 87 | private void loadStandardBanner() { 88 | ViewGroup bannerAdLayout = (ViewGroup) findViewById(R.id.banner_layout); 89 | mFlurryAdStandardBanner = new FlurryAdBanner(MainActivity.this, bannerAdLayout, 90 | "StandardBannerTestAd"); 91 | mFlurryAdStandardBanner.setListener(mAdBannerListener); 92 | Log.i(TAG, "Fetching banner ad"); 93 | 94 | mFlurryAdStandardBanner.fetchAd(); 95 | } 96 | 97 | FlurryAdBannerListener mAdBannerListener = new FlurryAdBannerListener() { 98 | @Override 99 | public void onFetched(FlurryAdBanner flurryAdBanner) { 100 | Log.i(TAG, "Banner ad fetched"); 101 | mFlurryAdStandardBanner.displayAd(); 102 | } 103 | 104 | @Override 105 | public void onRendered(FlurryAdBanner flurryAdBanner) { 106 | 107 | } 108 | 109 | @Override 110 | public void onShowFullscreen(FlurryAdBanner flurryAdBanner) { 111 | 112 | } 113 | 114 | @Override 115 | public void onCloseFullscreen(FlurryAdBanner flurryAdBanner) { 116 | 117 | } 118 | 119 | @Override 120 | public void onAppExit(FlurryAdBanner flurryAdBanner) { 121 | 122 | } 123 | 124 | @Override 125 | public void onClicked(FlurryAdBanner flurryAdBanner) { 126 | 127 | } 128 | 129 | @Override 130 | public void onVideoCompleted(FlurryAdBanner flurryAdBanner) { 131 | 132 | } 133 | 134 | @Override 135 | public void onError(FlurryAdBanner flurryAdBanner, FlurryAdErrorType flurryAdErrorType, int i) { 136 | Log.e(TAG, "Banner ad load error - Error type: " + flurryAdErrorType + " Code: " + i); 137 | mFlurryAdStandardBanner.destroy(); 138 | } 139 | }; 140 | } 141 | -------------------------------------------------------------------------------- /banner/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 17 |