You are on page 1of 9

FlurrySDK

AndroidUpgrade
Instructions

SDKversion6.x
Updated:8/25/2015

WelcometoFlurry!

Thisfilecontains:

1.Introduction
2.UpgradeInstructionsfrom5.xto6.x
3.UpgradeInstructionsfrom4.xto5.x
4.UpgradeInstructionsfrom3.3.xto4.0.0
5.UpgradeInstructionsfrom3.2.xto3.3.0
6.Upgradeinstructionto3.2fromapriorrelease

1.
Introduction

FlurryAndroidSDKreleaseversions3.3.0andlateraremodularizedtoallowourpartnerstoselectexactly
thecomponentstheywishtointegrateintotheirapp.Thiswillallowformoretargetedupdatesandsmaller
distributionsforpartnersthatonlyintegrateasubsetofavailableFlurryservices.

TheFlurryAndroidAnalyticslibraryisrequiredforanyintegration.YoumayoptionallyaddontheFlurryAds
library.MoreinformationontheselibrariesarecontainedintheirrespectiveREADMEdocuments,however
abriefdescriptionfollows:

FlurryAnalyticsallowsyoutotracktheusageandbehaviorofyourapplicationonusers'phonesfor
viewingintheFlurryDeveloperPortal.

FlurryAdvertisingallowsyoutoearnrevenuebyofferingadvertisinginyourapp.Supported
integrationsincludebanners,interstitials,andnativeads.

2.Upgradeto6.xfrom5.x

Upgradingfromversion5.xto6.xisastraightforwardprocessthatshouldtakelessthan10minutes.Ifyou
areupgradingfromversionpriorto5.0anduseads,pleasefirstfollowinstructionsinsection3(upgradeto
5.0.0)andthenreturntothissection.

FlurryAnalytics

UpgradeusingAndroidStudio:
1.

RemoveexistingFlurrylibraryjarsfromlibsfolder.

2.

AddFlurryAnalytics_6.x.x.jartoyourproject'slibsfolder.

UpgradeusingEclipse:
1.

RemoveanyexistingFlurrylibraryjarsfromyourprojectslibfolder.Also,removeallreferencefrom
theBuildPath.

2.

AddFlurryAnalytics_
6.x.x.jartoyourprojectslibsfolder.RightclickoneachJARfileandselect
BuildPath>AddtoBuildPath.

FlurryAds

UpgradeusingAndroidStudio:
1.

MakesuretofirstfollowstepsforFlurryAnalyticsintegrationabove.TheAdsjarisdependenton
theAnalyticsjar

2.
3.

AddFlurryAds
_6.x.x.jartoyourprojectslibsfolder.

NavigatetoFile>ProjectStructure>Module>Dependencies.

4.

Clickthe+buttoninthebottomoftheProjectStructurepopuptoadddependencies.

5.

SelectFiledependencyandaddlibs/FlurryAds
_6.x.x.jar.

UpgradeusingEclipse:
1.

MakesuretofirstfollowstepsforFlurryAnalyticsintegrationabove.TheAdsjarisdependenton
theAnalyticsjar

2.

AddFlurryAds_6.x.x.jartoyourprojectslibsfolder.

3.

RightclickontheAdsJARfileandselectBuildPath>AddtoBuildPath.

3.Upgradeto5.xfrom4.x

Upgradingfromversion4.xto5.xisastraightforwardprocessthatshouldtakelessthan10minutes.Ifyou
areupgradingfromversionpriorto4.0anduseads,pleasefirstfollowinstructionsinsection4(upgradeto
4.0.0)andthenreturntothissection.

FlurryAnalytics

UpgradeusingAndroidStudio:
3.

RemoveexistingFlurrylibraryjarsfromlibsfolder.

4.

AddFlurryAnalytics_5.x.jartoyourproject'slibsfolder.

UpgradeusingEclipse:
3.

RemoveanyexistingFlurrylibraryjarsfromyourprojectslibfolder.Also,removeallreferencefrom
theBuildPath.

4.

AddFlurryAnalytics_
5.x.jartoyourprojectslibsfolder.RightclickoneachJARfileandselectBuild
Path>AddtoBuildPath.

Introducinginitializefunction

FlurryAgenthasanewinitializationfunction,FlurryAgent.init(),thatMUSTbecalledassoonaspossible
afteryourapplicationisstarted.
AnyFlurryAgentconfigurationthatwaspreviouslydonebeforeasession

wasstartedshouldbedonebeforeinitinstead.
Itisrecommendedthatyoucallthisfunctioninthe

onCreate()methodofyourApplicationclass.IfyoudonotcurrentlyextendtheApplicationclassinyourapp,
youcandosobyaddingaclasssuchasthis:

publicclassMyApplicationextendsApplication{
@Override
publicvoidonCreate(){
super.onCreate()

//configureFlurry
FlurryAgent.setLogEnabled(false)

//initFlurry
FlurryAgent.init(this,MY_FLURRY_APIKEY)
}
}

andinyourAndroidManifest.xml,declaringtheapplicationtopointtoyournewapplicationclass:

<application
android:name=".MyApplication"

</application>

YoumayalsocallFlurryAgent.init()justbeforeFlurryAgent.onStartSession().Itissafetocall
FlurryAgent.init()morethanonceprovidedthatthesameAPIkeyisalwaysusedduringthelifetimeofthe
application.

onStartSessionandonEndSession

SessionsareautomaticallytrackedonIceCreamSandwich(APIlevel14)andabove.
Ifthe

minSdkVersionforyourappissetto14orgreateryounolongerneedtomanuallycallonStartSession()and
onEndSession()unlessyouaretrackingsessionsusingaContextthatisnotanActivity(i.e.aService).You
maysafelyremovethesemethodsfromyourcode.AppsthatrunonGingerbreadorHoneycomboruse
contextthatisnotanactivitywillstillneedtocallonStartSession()andonEndSession()asbefore.

LocationTracking

LocationtrackingisnowpassiveandwillusecachedlocationinsteadofactiveGPStoavoidexcessive
batteryusage.YoumaycallFlurryAgent.setLocation()tosetthelocationmanuallyifyourappusesthe
GPS.

ModifiedMethods

FlurryAgent.onStartSession(Contextcontext,StringapiKey)isnowdeprecated.
Pleaseuse

FlurryAgent.onStartSession(Contextcontext)instead.
TheAPIkeyisnowsuppliedintheFlurryAgent.init()
functionandisnolongerrequiredhere.

RemovedMethods

FlurryAgent.getUseHttps()

FlurryAgent.setUseHttps(booleanuseHttps)

HTTPSisnowmandatoryduetoGooglePlay!Storerestrictions.Thesemethodshavebeenremovedfrom
theSDKandshouldbecompletelyremovedfromyourapplication.

FlurryAds

UpgradeusingAndroidStudio:
6.

MakesuretofirstfollowstepsforFlurryAnalyticsintegrationabove.TheAdsjarisdependenton
theAnalyticsjar

7.
8.
9.

AddFlurryAds
5.x.jartoyourprojectslibsfolder.

NavigatetoFile>ProjectStructure>Module>Dependencies.
Clickthe+buttoninthebottomoftheProjectStructurepopuptoadddependencies.

10. SelectFiledependencyandaddlibs/FlurryAds
5.x.jar.

UpgradeusingEclipse:
4.

MakesuretofirstfollowstepsforFlurryAnalyticsintegrationabove.TheAdsjarisdependenton
theAnalyticsjar

5.
6.

AddFlurryAds
5.x.jartoyourprojectslibsfolder.

RightclickontheAdsJARfileandselectBuildPath>AddtoBuildPath.

CodeSize

ThesizeandmethodcountoftheFlurryAdsSDKhasbeensignificantlyreducedinthisrelease.Thisdoes
notaffectanyfunctionalityandiscodeoptimization.

NativeAds

TheFlurryAdsSDKnowincludessupportforNativeAds,whichcanbefullycustomizedtothelookandfeel
ofyourapplication.PleaserefertotheAdsREADMEifyouwishtoincludeNativeAdsinyourapp.

NewObjectAPI

WehaveintroducedanewobjectbasedAPIforAdstomakeintegrationeveneasierthanbefore!
ItisrecommendedthatdevelopersswitchtothenewadsAPIassoonaspossible.TheFlurryAdsAPIwill
continuetoworkasbefore,buthasbeendeprecated.Also,thenewAPIisrequiredforNativeAds.Please
seetheAdsREADMEformoredetails.

Pleasenote:ifyouareusingusingFlurrytomediateathirdpartySDKwithICustomAdNetworkHandler,

youwillneedtocontinueusingtheoldAPItoserveadsforthisnetwork.

4.Upgradeto4.0.0from3.x

Upgradingfromversion3.3.xto4.0.0isastraightforwardprocessthatshouldtakelessthan10minutes.If
youareupgradingfromaversionpriorto3.3anduseads,pleasefirstfollowinstructionsinsection5
(upgradeto3.3.0)andthenreturntothissection.

FlurryAdvertisingSDKnowusestheAndroidAdvertisingIDprovidedbyGooglePlayServicesandwill
checkforandrespecttheuser'sadtrackingpreference
.Formoreinformation,pleasevisit
https://developer.android.com/google/playservices/id.html

FlurryAnalytics

UpgradeusingAndroidStudio:
1.

RemoveexistingFlurrylibraryjarsfromlibsfolder.

2.

AddFlurryAnalytics
4.0.0.jartoyourproject'slibsfolder.

3.

NavigatetoFile>ProjectStructure>Module>Dependencies.

4.

Clickthe+buttoninthebottomoftheProjectStructurepopuptoadddependencies.

5.

SelectFiledependencyandaddlibs/FlurryAnalytics
4.0.0.jar.

6.

AddGooglePlayServiceslibrary.Pleasefollowinstructionsin
http://developer.android.com/google/playservices/setup.html#Setup

7.

Addv4supportlibrary(orgreater).Pleasefollowinstructionsin
https://developer.android.com/tools/supportlibrary/setup.html#addlibrary

UpgradeusingEclipse:
1.

RemoveanyexistingFlurrylibraryjarsfromyourprojectslibfolder.Also,removeallreferencefrom
theBuildPath.

2.

AddFlurryAnalytics
4.0.0.jartoyourprojectslibsfolder.RightclickoneachJARfileandselectBuild
Path>AddtoBuildPath.

3.

AddGooglePlayServicelibrary.Pleasefollowinstructionsat
http://developer.android.com/google/playservices/setup.html#Setup

4.

Addv4supportlibrary(orgreater).Pleasefollowinstructionsat
https://developer.android.com/tools/supportlibrary/setup.html#addlibrary

FlurryAds

UpgradeusingAndroidStudio:
1.

MakesuretofirstfollowstepsforFlurryAnalyticsintegrationabove.TheAdsjarisdependenton
theAnalyticsjar

2.
3.

AddFlurryAds
4.0.0.jartoyourprojectslibsfolder.

NavigatetoFile>ProjectStructure>Module>Dependencies.

4.

Clickthe+buttoninthebottomoftheProjectStructurepopuptoadddependencies.

5.

SelectFiledependencyandaddlibs/FlurryAds
4.0.0.jar.

UpgradeusingEclipse:
1.

MakesuretofirstfollowstepsforFlurryAnalyticsintegrationabove.TheAdsjarisdependenton
theAnalyticsjar

2.
3.

AddFlurryAds
4.0.0.jartoyourprojectslibsfolder.

RightclickontheAdsJARfileandselectBuildPath>AddtoBuildPath.

Upgradeto4.0.0formediationofGoogleMobileAds(previouslyAdMob)Ads

1.

AdMobisnowGoogleMobileAds.TheGooglePlayServiceslibraryautomaticallyincludes
everythingnecessaryforGMStoshowads.AnystandaloneAdMoblibraryshouldberemoved.
Also,removeanyreferencetotheAdMoblibraryfromtheBuildPath.

2.

TheMetadataandActivityhavechanged.PleaseremoveallAdMobactivitiesandmetadataand
addthefollowing:
<activity

android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|scree
nSize|smallestScreenSize"/>

<metadata

android:name="com.flurry.gms.ads.MY_AD_UNIT_ID"

android:value="@string/ffp_gms_ads_apikey"/>
<metadata

android:name="com.flurry.gms.ads.MYTEST_AD_DEVICE_ID"

android:value="@string/ffp_gms_ads_testdevicekey"/>
<metadata

android:name="com.flurry.gms.ads.test"

android:value="true"/>

5.Upgradeto3.3.0

Upgradingfromversion3.2.xto3.3.0isastraightforwardprocessthatshouldtakelessthan10minutes.If
youareupgradingfromaversionpriorto3.2anduseads,pleasefirstfollowinstructionsinsection6
(upgradeto3.2.0)andthenreturntothissection.

FlurryAnalytics
1.

RemoveanyexistingFlurrylibraryjarsfromyourprojectslibfolder.

2.

AddFlurryAnalytics
3.3.x.jartoyourproject'slibsfolder.

FlurryAds

MakesuretofirstfollowstepsforFlurryAnalyticsintegrationabove.TheAdsjarisdependentonthe
Analyticsjar
AddFlurryAds
3.3.x.jartoyourprojectslibsfolder.

IfyouhaveimplementedaFlurryAdListener,addtheonRenderedmethod:

publicclassMyAdListenerimplementsFlurryAdListener{

.....

@Override
publicvoidonRendered(StringadSpaceName)
{
//Handlerendered
}

6.Upgradeto3.2.0

FlurrySDKreleasespriorto3.2.0includedtheadvertisingrelatedAPIsundertheclassFlurryAgent.Starting
withversion3.2.0,advertisingrelatedmethodsaregroupedunderanewclasscalledFlurryAds.

IfyouareupgradingfromapreviousversionoftheSDK,youwillencountercompilationerrorsfromjavac(or
Eclipse).

Tofixthese,ateachinstanceofanerror,simplyreplacereferencestoFlurryAgentwithFlurryAds.

Codeexample
Heresasimplediffafterupgradingtov3.2.xoftheSDKfromaversionthatpredatesv3.2.0:

publicclassExampleextendsActivityimplementsFlurryAdListener{

FrameLayoutmBanner
publicvoidonCreate(Bundlebundle){
super.onCreate(bundle)
setContentView(R.layout.example)
mBanner=(FrameLayout)findViewById(R.id.banner)

FlurryAgent.setAdListener(this)

FlurryAds.setAdListener(this)
}
publicvoidonStart(){
super.onStart()
FlurryAgent.onStartSession(this,mApiKey)

FlurryAgent.fetchAd(this,mAdSpaceName,mBanner,BANNER_BOTTOM)

FlurryAds.fetchAd(this,mAdSpaceName,mBanner,BANNER_BOTTOM)
}
publicvoidspaceDidReceiveAd(StringadSpace){

FlurryAgent.displayAd(this,mAdSpaceName,mBanner)

FlurryAds.displayAd(this,mAdSpaceName,mBanner)
}
publicvoidonStop(){

super.onStop()
FlurryAgent.onEndSession(this)
}
}

Pleaseletusknowifyouhaveanyquestions.Ifyouneedanyhelp,justemailsupport@flurry.com!

You might also like