Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DevFest Atlanta - Firebase Remote Config + Fire...

Rebecca Franks
November 12, 2016

DevFest Atlanta - Firebase Remote Config + Firebase Test Lab

Rebecca Franks

November 12, 2016
Tweet

More Decks by Rebecca Franks

Other Decks in Science

Transcript

  1. Firebase Remote Config & Test Lab Rebecca Franks Google Developer

    Expert - Android @riggaroo riggaroo.co.za
  2. Firebase Dev Summit 2016 - Berlin • New Analytics Features

    - StreamView / DebugView • Crash Reporting is now out of Beta with new features • Udacity Course - Firebase in a weekend • Lots of other small things
  3. Agenda • Remote Config • Setup & Basic Usage •

    Conditions • A/B Testing • Staged Rollouts • Custom Analytics Audiences • Test Lab • Robo Tests • Instrumentation Tests
  4. • Key / Value Pairs saved on Firebase server •

    Change behaviour at runtime • No app update required Remote Config
  5. Features • Quickly deploy changes • Customise your app for

    segments of user base • Run A/B Tests • Free!
  6. Android Setup Project Level build.gradle: buildscript { // ... dependencies

    { // ... classpath 'com.google.gms:google-services:3.0.0' } }
  7. Android Setup App Level app/build.gradle: dependencies { // ... compile

    'com.google.firebase:firebase-core:9.8.0' compile 'com.google.firebase:firebase-config:9.8.0' } // At the bottom apply plugin: 'com.google.gms.google-services'
  8. Android Setup • Download google-services.json • Place in app/ folder.

    • Create remote config defaults file - res/xml/ remote_config.xml <?xml version="1.0" encoding="utf-8"?> <defaultsMap> <entry> <key>welcome_message</key> <value>Hello User!</value> </entry> </defaultsMap>
  9. Initialise Firebase Remote Config remoteConfig = FirebaseRemoteConfig.getInstance(); FirebaseRemoteConfigSettings config =

    new FirebaseRemoteConfigSettings.Builder() .setDeveloperModeEnabled(BuildConfig.DEBUG) .build(); remoteConfig.setConfigSettings(config); remoteConfig.setDefaults(R.xml.remote_config);
  10. Fetch remoteConfig.fetch(CACHE_TIME_SECONDS).addOnComplete Listener(new OnCompleteListener<Void>() { }); @Override public void onComplete(@NonNull

    Task<Void> task) { if (task.isSuccessful()) { Log.d(TAG, "Fetch Succeeded"); remoteConfig.activateFetched(); } else { Log.d(TAG, "Fetch Failed"); } displayWelcomeMessage(); }
  11. Types you can store on Remote Config • Strings •

    Integers • Booleans • Long • Double • Byte Arrays
  12. Conditions • Powerful decision- making server • Target a group

    of app instances • Made up of one or more rules that must evaluate to true
  13. Types of Conditionals • OS Type • App ID •

    Device in Region or Country • App Version • Language • Audience from Analytics • Random Percentile
  14. How does the app decide what value to use? In-app

    default value? Static initialised value No No Yes Yes Parameter value Value fetched from the server?
  15. A/B Testing & Feature Rollout • Experimenting with your UI

    • Different audiences receive different UI
  16. A/B Testing - Android Setup String experiment = config.getString("experiment_variant"); FirebaseAnalytics.getInstance(this)

    .setUserProperty("Experiment", experiment); if (experiment.equals("variant_a")) { //.. } else if (experiment.equals("variant_b")) { //... } else { //.. }
  17. Analytics Log your events + track in the Firebase Console

    buttonCheckout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { //.. } }); firebaseAnalytics.logEvent(“CheckoutClicked”, new Bundle());
  18. Gradual Feature Rollouts • Leverage “User in Random Percentile” feature

    • Gradually increase the value of the percentage • Rollout to more customers as you gain confidence
  19. What is Firebase Test Lab? • Run tests at Googles

    Device Farm • Virtual Devices + Physical Devices • Robo Tests & Custom Instrumentation Tests • Free Tier • 5 tests per day on physical devices • 10 tests per day on virtual devices • Pay per hour
  20. Why run tests on Firebase? • History of results •

    Logs attached to each test • Screenshots & videos • Don’t have to manage your own device farm
  21. Robo Test • Random clicking around in your application +

    recording results • No code changes required to run a Robo Test • Uses Monkey Runner
  22. Instrumentation Tests • Need to be writing test code •

    Espresso • Robotium • UIAutomator
  23. Recap •Remote Config •Getting setup •Using remote config •A/B Testing

    + Gradual Roll outs •Test Lab •Robo Tests •Instrumentation tests
  24. Links Firebase Remote Config - https://firebase.google.com/docs/remote-config/ Firebase Test Lab -

    https://firebase.google.com/docs/test-lab/ Testing Support Library - https://developer.android.com/topic/libraries/ testing-support-library/index.html Demo Remote Config Project - https://github.com/riggaroo/remote-config- demo-ssa-launchpad-2016 Demo Test Lab Project - https://github.com/googlesamples/android- testing/tree/master/ui/uiautomator/BasicSample