我想让Startapp Ads刚显示时就显示。 所以我决定依赖调用的Firebase服务(远程配置)。 但这并没有给我我想要的结果。 这是我的代码:
@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();
}
}