Created
September 15, 2014 19:22
-
-
Save flurrydev/6df22436fcdf1712878c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.flurry.android.v2; | |
| import android.app.Activity; | |
| import android.content.Context; | |
| import android.os.Bundle; | |
| import android.util.Log; | |
| import android.widget.Button; | |
| import android.widget.FrameLayout; | |
| import android.widget.RelativeLayout; | |
| import android.widget.Spinner; | |
| import com.flurry.android.FlurryAdSize; | |
| import com.flurry.android.FlurryAds; | |
| import com.flurry.android.FlurryAgent; | |
| public class FlurryAdStreamExample extends Activity implements FlurryAdStreamListener { | |
| private final String kLogTag = "FlurryAdServingAPI"; | |
| public static String apiKey; | |
| private Context mContext; | |
| private RelativeLayout mainLayout; | |
| private FlurryAdStream adStream ; | |
| private String adSpaceName = "Stream Ad"; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| //setContentView(R.layout.flurry_activity); | |
| mContext = FlurryAdStreamExample.this; | |
| mainLayout = new RelativeLayout(this); | |
| apiKey = ""; | |
| } | |
| @Override | |
| public void onStart() { | |
| super.onStart(); | |
| try { | |
| FlurryAgent.setContinueSessionMillis(5001); | |
| Log.d(kLogTag, "onStartSession: " + apiKey); | |
| FlurryAgent.onStartSession(mContext, apiKey); | |
| FlurryAgent.setLogEnabled(true); | |
| FlurryAgent.setLogLevel(Log.VERBOSE); | |
| FlurryAds.enableTestAds(false); | |
| adStream = new FlurryAdStream(mContext, adSpaceName, FlurryAdStreamSize.INFEED_300X250); | |
| adStream.fetchAd(); | |
| adStream.setListener(this); | |
| } catch (Exception e) { | |
| Log.e(kLogTag, e.getMessage()); | |
| } | |
| } | |
| @Override | |
| public void onStop() { | |
| super.onStop(); | |
| Log.d(kLogTag, "onEndSession "); | |
| adStream.destroy(); | |
| FlurryAgent.onEndSession(this); | |
| } | |
| @Override | |
| public void onFetched(FlurryAdStream adView) { | |
| mainLayout.addView(adView); | |
| } | |
| @Override | |
| public void onFetchFailed(FlurryAdStream adView, FlurryAdError adError) { | |
| // TODO Auto-generated method stub | |
| } | |
| @Override | |
| public void onRendered(FlurryAdStream adView) { | |
| // TODO Auto-generated method stub | |
| } | |
| @Override | |
| public void onRenderFailed(FlurryAdStream adView, FlurryAdError adError) { | |
| // TODO Auto-generated method stub | |
| } | |
| @Override | |
| public void onShowFullscreen(FlurryAdStream adView) { | |
| // TODO Auto-generated method stub | |
| } | |
| @Override | |
| public void onCloseFullscreen(FlurryAdStream adView) { | |
| // TODO Auto-generated method stub | |
| } | |
| @Override | |
| public void onAppExit(FlurryAdStream adView) { | |
| // TODO Auto-generated method stub | |
| } | |
| @Override | |
| public void onClicked(FlurryAdStream adView) { | |
| // TODO Auto-generated method stub | |
| } | |
| @Override | |
| public void onVideoCompleted(FlurryAdStream adView) { | |
| // TODO Auto-generated method stub | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment