# ZoomSDK.getInstance() is not being called from the main thread for Cordova app

**URL:** <https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060>\
**Category:** Ionic\
**Created:** [December 10, 2022, 2:43am UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060 "2022-12-10T02:43:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![shengming.yao](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@shengming.yao](https://devforum.zoom.us/u/shengming.yao)\
**Post date:** [December 10, 2022, 2:43am UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/1 "2022-12-10T02:43:42Z")

</div>

The Android Zoom Meeting SDK in a Cordova app using an updated version of cordova.plugin.zoom plugin so **ZoomSDK.getInstance() is not being called from the main thread**.  
Until v5.10.6.6361 it was working OK but when we tried to update the version to 5.11 we got “getInstance is not called from main thread” error when calling ZoomSDK.getInstance()

We need to ionic .

**Which Android Meeting SDK version?**  
Since V.5.1, produced in v5.11.0.6883 and v5.11.1.6928

**Smartphone (please complete the following information):**  
Any Android phone

---

<div class="post-metadata">

**Author:** ![PursueCare](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@PursueCare](https://devforum.zoom.us/u/PursueCare)\
**Post date:** [January 7, 2023, 8:10pm UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/2 "2023-01-07T20:10:03Z")

</div>

Were you ever able to get this figured out?

---

<div class="post-metadata">

**Author:** ![qing.peng](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/qing.peng/32/44350_2.png) [@qing.peng](https://devforum.zoom.us/u/qing.peng)\
**Post date:** [January 10, 2023, 12:47am UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/3 "2023-01-10T00:47:59Z")

</div>

Hi @shengming.yao ,

I ran the sample app in Meeting SDK 5.11, and noticed that ZoomSDK.getInstance() can work properly in the sample app.

Could you check if you run ZoomSDK.getInstance() in another thread in your app? If this is the case, you can try to run ZoomSDK.getInstance() in main thread by:

```auto
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            ZoomSDK.getInstance();
        }
    });

```

Please let me know if it works for you, thanks.

---

<div class="post-metadata">

**Author:** ![PursueCare](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@PursueCare](https://devforum.zoom.us/u/PursueCare)\
**Post date:** [January 11, 2023, 9:03am UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/5 "2023-01-11T09:03:30Z")

</div>

We are trying to build this using IONIC framework can you please suggest where and which files we can apply this changes exactly

I have tried in AuthThread.java of ZOOM

```
 new Handler(Looper.getMainLooper()).post(() -> {
    this.mZoomSDK = ZoomSDK.getInstance();

```

});

but still facing the same issue

Thanks in Advance

---

<div class="post-metadata">

**Author:** ![qing.peng](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/qing.peng/32/44350_2.png) [@qing.peng](https://devforum.zoom.us/u/qing.peng)\
**Post date:** [January 11, 2023, 10:57pm UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/6 "2023-01-11T22:57:29Z")

</div>

Hi @PursueCare , thanks for your feedback, can you please try Activity.runOnUiThread?

Example:

```auto
instance.getActivity().runOnUiThread(new Runnable() {
    @Override
    public void run() {
          this.mZoomSDK = ZoomSDK.getInstance();
    }
 }

```

---

<div class="post-metadata">

**Author:** ![PursueCare](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@PursueCare](https://devforum.zoom.us/u/PursueCare)\
**Post date:** [January 12, 2023, 3:17pm UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/7 "2023-01-12T15:17:03Z")

</div>

Hi Thanks for the support

As per the suggestion i have implemented in the following way

cordova.getActivity().runOnUiThread(new Runnable() {  
@Override  
public void run() {  
ZoomSDK zoomSDK = ZoomSDK.getInstance();  
}  
});

getInstace() not called from main thread is solved

Error : “isInitialized is not called from main thread”, source: [http://localhost/main-es2015.js](http://localhost/main-es2015.js) (2157)

When applied the same kind of runOnUniThread method facing Issue like “ZoomSDK has not been initialized successfully”

Thanks in advance

---

<div class="post-metadata">

**Author:** ![PursueCare](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@PursueCare](https://devforum.zoom.us/u/PursueCare)\
**Post date:** [January 17, 2023, 5:28pm UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/8 "2023-01-17T17:28:47Z")

</div>

We are still seeing this error message “ZoomSDK has not been initialized successfully” after implementing your suggestions.

---

<div class="post-metadata">

**Author:** ![qing.peng](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/qing.peng/32/44350_2.png) [@qing.peng](https://devforum.zoom.us/u/qing.peng)\
**Post date:** [January 17, 2023, 6:56pm UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/9 "2023-01-17T18:56:00Z")

</div>

Hi @PursueCare , I think the problem is that you have not set up the required parameters for initializing ZoomSDK. Since we do not support ionic plugin anymore, there is no documentation about the setup of ionic app. But you can see the documentation of Meeting SDK Android for reference, to set up all the required fields:

[https://marketplace.zoom.us/docs/sdk/native-sdks/android/build-an-app/](https://marketplace.zoom.us/docs/sdk/native-sdks/android/build-an-app/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [February 17, 2023, 4:56am UTC](https://devforum.zoom.us/t/zoomsdk-getinstance-is-not-being-called-from-the-main-thread-for-cordova-app/80060/10 "2023-02-17T04:56:25Z")

</div>

Closed on February 17, 2023, 4:56am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
