Repro - Mobile Analytics for growth
日本語
Resources
Growth Hack Journal (JA)
Sign Up Back to Dashboard
  • System Requirements
  • Dashboard Guide
  • Development Guide
    • Signup
    • iOS/Android SDK
      • Get Started
      • Session Lifecycle
      • User ID
      • Device ID
      • User Profile
      • Event Tracking
      • Push Notification
      • NewsFeed
      • In-App Message
      • Silver Egg Recommendation Messages
      • UX Optimizer (Beta version)
        • iOS
        • Android
          • Remote Config interface
          • Access to Remote Config values
        • Unity
        • Cocos2d-x
        • React Native
        • Flutter
      • WebView
      • Opt-out feature
      • Set attribution data from Ajdust to Repro
      • Set attribution data from AppsFlyer to Repro
      • Log Level
      • Verification Method
    • Web
    • Audience API
    • Audience Import(β)
    • Push API
    • User Profile API
    • User Profile Bulk Import API
  • Release Notes
  • FAQ
java

UX Optimizer – Android¶

Remote Config interface¶

Access to UX Optimizer API is possible via the below API:

Repro.getRemoteConfig()

Setting Local defaults¶

Three methods are avalible. It is recommended to call these 3 methods in your mainActivity:onCreate before calling Repro.setup().

From a Map¶

HashMap<String, Object> values = new HashMap<>();
values.put("key1", "def1");
values.put("key2", "def2");
Repro.getRemoteConfig().setDefaultsFromMap(values);

From a raw Json string¶

Repro.getRemoteConfig().setDefaultsFromJsonString("{\"key1\": \"zzz1\", \"key2\": \"zzz2\"}")

From a Json file¶

Repro.getRemoteConfig().setDefaultsFromJsonFile(pathToJsonFile)

Access to Remote Config values¶

Single value¶

String value = Repro.getRemoteConfig().get("key1").asString();

Note

  • The return value of Repro.getRemoteConfig().get('key1') is always an instance of RemoteConfigValue and never null.

  • RemoteConfigValue 's asString() will return null, while toString() will return an empty string if the key is not found.

Whole Remote Config¶

Repro.getRemoteConfig().getAllValues()

will return a Map with all values.

All items with a certain prefix¶

Repro.getRemoteConfig().getAllValuesWithPrefix("color")

will return a Map with all values of which keys start with color.

Reset values¶

While in development, you may call Repro.getRemoteConfig().forceReset() to reset to the initial state. You will have to set local defaults & fetch callbacks again, after calling forceReset().

Fetch & Activate¶

Everytime the app enters foreground, Remote Config values wil be retireved from the Repro server & automatically activated. Therefore, a fetch callback is not necessary. If you want to control when to apply the fetched values, you can call activateFetched() . If you want to switch old Remote Config values for new values at a certain point in time after they have been retrieved, setting a callback is recommended.

  • Only one callback can be set

  • The callback is not gurateed to be called.

  • The callback timeout is set in milliseconds like other android intefaces expect.

  • The callback on the listener will be executed on the UI Thread.

  • Without a call to Repro.setup(), fetching is not performed and the callback will never be exceuted.

  • A fetch callback should not be set in onCreate and only in onResume of the main activity.

  • activateFetched() should be excecuted after the callback has been exceuted. From within the callback block is of course also possible. Like in the follwoing example.

fetch example

Repro.getRemoteConfig().fetch(3000, new RemoteConfigListener() {
    @Override
    public void onCompletion(FetchStatus status) {
        if (status == FetchStatus.SUCCESS) {
            Log.d("remote_config", "BEFORE " + Repro.getRemoteConfig().getAllValues().toString());
            Repro.getRemoteConfig().activateFetched();
            Log.d("remote_config", "AFTER  " + Repro.getRemoteConfig().getAllValues().toString());
        }
    }
});
  • « UX Optimizer – iOS
  • UX Optimizer – Unity »

About Us Careers Terms of Service Privacy Policy Cookie Policy

© 2020 Repro Inc.