Closed danieljimeneznz closed 3 years ago
@danieljimeneznz hey, this is how it is because of the StoreKit concurrency on iOS native. So on launch we need to subscribe for StoreKit notifications. If we do it manually through Adapty.activate()
method, we might lose some StoreKit notifications – which is crucial. That's why we automatically activate SDK right from the native launch methods.
Looking through the documentation I noticed that the Android/iOS SDK requires initialization via something like:
Adapty.activate("PUBLIC_SDK_KEY", customerUserId: "YOUR_USER_ID")
However, the Flutter SDK uses the API key in the plist/manifest files, and is automatically registered via the
activateOnLaunch
function on the native side.I was wondering what is the reason for starting the Adapty SDK on the application launch rather than having the Flutter SDK activated in a similar manner to iOS/Android? i.e. I call the
activate
function similar to the above in Flutter.(Doing the above would allow me as the developer to control when the SDK is activated, which means if I wanted to, I could choose to activate the SDK after a user has authenticated and ensure Adapty is using my customerUserIds during the entire lifetime of the SDK - which would reduce the effects of https://github.com/adaptyteam/AdaptySDK-Flutter/issues/23 )
Happy to make the changes, and open a PR (with major version bump ofc) but thought I would ask about the reasoning first in-case the current behavior is required for something like push notifications (or another reason for starting the Android/iOS SDK outside of the Flutter process?)