appodeal / react-native-appodeal

Official React Native package that adds Appodeal SDK support to your react-native application.
https://appodeal.com
59 stars 37 forks source link

Feature Request: Initialize callback #37

Closed dylancom closed 4 years ago

dylancom commented 4 years ago

If I directly show a banner after Appodeal.initialize('Your app key', adTypes, consent), it won't display on App startup. Unless I add a delay of around 1 second in between. Is there any way to know when Appodeal was initialized, so I can show the banner directly after the callback?

staskochkin commented 4 years ago

Hi @dylancom. It seems to be a bug on native SDK side. The idea was that once you call initialise method of Appodeal SDK you are able to use banners without awaiting initialisation callback. We will research this case and add fixes in future release of Appodeal SDK. For now please use your approach with extra delay.

tushali024 commented 4 years ago

@dylancom

I've resolved this issue by updating state value. so on initialize callback I've updated the state and show banner once appodeal SDK initialized.

Here's the code snippet I've used:

//componentDidMount initialize(true, (status: AppodealConsentStatus, regulation: AppodealConsentRegulation) => { this.setState({ initialised: true, }) })

//render {this.state.initialised ( //show banner view here

)}

staskochkin commented 4 years ago

@dylancom We've fixed banner behaviour in 2.6.5. Since 2.6.5 banner view API can be used synchronously after Appodeal.initialize method.

dylancom commented 4 years ago

@staskochkin Thanks, I'm going to test it now!