NativeApi.InitializeAsync() not really async
See original GitHub issueCurrently NativeApi.InitializeAsync()
wraps NativeSdkMethods.Init()
to return a Task
. However, NativeSdkMethods.Init()
does take a while to start (about 300ms on my laptop), blocking the calling thread.
I’d suggest to spin a new thread doing something like this:
return Task.Run(_nativeSdkMethods.Init)
.ContinueWith(/* error handling */);
Thoughts?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
c# - InitializeAsync in MediaCapture doesnt work
You need to change your method like this: public async Task Foo() { //code try { MediaCapture mc = new MediaCapture(); await mc....
Read more >UnityServices.InitializeAsync + ConfigurationBuilder. ...
I tried with an async method the result is the same - native crash on Android. Not exactly the same, the crash looks...
Read more >Initialize StateNotifierProvider with async data · Issue #57
In this case I call getBaseData() to load base data from API to use in further screens (ex. HomeScreen -> SettingsScreen -> BaseDataScreen)....
Read more >Asynchronous initialisation and cleanup operations with xUnit
I/O-bound operations are a great use case of asynchronous tasks, so I was wondering how xUnit would help me support this.
Read more >Initialize Unity Gaming Services | In App Purchasing | 4.4.1
InitializeAsync() to initialize all Unity Gaming Services at once. It returns a Task that enables you to monitor the initialization's ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Latest docs in release branch now have a note in the getting started guide about needing to wait for a couple seconds or use the method of listening for the
DeviceAccess
event.Hm, that might be the way to go. Document it and then users can either use the event loop if they have it available (optimal), or insert an artificial delay of a second or two that should leave enough time to init (not as accurate, but probably good enough if it’s not feasible to get the event loop).