Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early / Eager SDK Initialization from Native Code #121

Open
buschtoens opened this issue Oct 15, 2020 · 4 comments · May be fixed by #124
Open

Early / Eager SDK Initialization from Native Code #121

buschtoens opened this issue Oct 15, 2020 · 4 comments · May be fixed by #124

Comments

@buschtoens
Copy link

If Adjust lies on a time-critical path, as could be the case for e.g. the deferred deep link callback, it would be desirable to initialize the SDK as early as possible, to minimize the time to wait until the callback resolves.

I'd love, if there were convenient way to initialize the SDK from the native code, before the Cordova / Capacitor WebView even starts loading, and then still allow the WebView to register callback listeners.

@buschtoens buschtoens changed the title Early / Eager SDK Initialiation from Native Code Early / Eager SDK Initialization from Native Code Oct 15, 2020
@uerceg
Copy link
Contributor

uerceg commented Nov 2, 2020

Hi @buschtoens

Sorry for a bit delayed response. It's a nice idea, but in current state of things not really achievable because our callback definition mechanism "ties you" to define them in place where you perform configuration object creation and SDK initialisation (in your example from above, the native world). But this might be interesting feature to add. What we might do (this is actually what we are doing for all getters for next major SDK release) is to add asynchronous getter to Adjust interface which you can use to get (in this case) deferred deep link and that SDK triggers it as soon as it gets in possession of deferred deep link. Upcoming 5.0.0 release will have this for sure, but we will also check how feasible this might be in current 4.x.x version. Will keep you posted.

Btw, +1 from my end on idea on how to "speed up" deferred deep link obtaining in your Cordova/Capacitor layer. It's pretty cool idea, but just huge majority of people is unwilling to take down this road and mess with native code at all.

Cheers

@buschtoens
Copy link
Author

Thanks for getting back to me!

We experimented with initializing the config early from the native side and registering fake listeners for all the COMMAND_SET_*_CALLBACK events, that buffer all calls and replay them, once the real JS bridge registers listeners. We haven't tested it yet, but if it does work out, I can submit a PR, so that you can toy around with the concept.

@uerceg
Copy link
Contributor

uerceg commented Nov 2, 2020

Absolutely. PRs are always more than welcomed and if you end up with something which solves the issue, feel free to submit it and we're gonna check it out and if all works well, add to one of next releases.

@buschtoens buschtoens linked a pull request Nov 2, 2020 that will close this issue
4 tasks
@buschtoens
Copy link
Author

@uerceg Great! I've submitted a preliminary draft PR #124 that is largely just a carbon-copy from our local patches to cordova_sdk, but should work and also should explain the concept well enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants