0

I want to make Startapp Ads display just when I want it to display. so I decide to depend on firebase service that called (remote config). but it didn't give me the result I want. here's my code:

    @Override
     protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
      remoteConfig.setConfigSettings(new 
     FirebaseRemoteConfigSettings.Builder()
    .setDeveloperModeEnabled(true)
    .build());

    HashMap<String, Object>defaults = new HashMap<>();
    defaults.put("startApp_Ads_required",false);
    defaults.put("startApp_Splash_required",false);
    remoteConfig.setDefaults(defaults);

    final Task<Void> fetch = remoteConfig.fetch(0);
    fetch.addOnSuccessListener(this, new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void aVoid) {
            remoteConfig.fetchAndActivate();

            adsControl();

        }
    });

     setContentView(R.layout.activity_main);

     *
     *
     private void adsControl(){

     boolean startApp_Splash_required = 
          (boolean)remoteConfig.getBoolean("startApp_Splash_required");
     boolean startApp_Ads_required = 
          (boolean)remoteConfig.getBoolean("startApp_Ads_required");

     StartAppSDK.init(this, "201033969",startApp_Ads_required);

     if(!startApp_Splash_required) {
        StartAppAd.disableSplash();
     }
     }
Ph Anas
  • 1
  • 2
  • What line of code doesn't work for you? What does it do? What did you expect it to do? – Frank van Puffelen Apr 30 '19 at 23:02
  • when I change the value of "startApp_Ads_required" to true then the app still don't showing Ads. – Ph Anas Apr 30 '19 at 23:43
  • Did you check what value `startApp_Ads_required` has? Also note that there is a limit to how often calling `fetch()` actually gets new values, unless you [enable developer mode](https://firebase.google.com/docs/remote-config/android#how_it_works) (which can only be done on a limited number of devices). – Frank van Puffelen May 01 '19 at 02:00

0 Answers0