Promise failing in case of a call to @JavascriptInterface method

Promise failing in case of a call to @JavascriptInterface method.

getMerchantKey(merchantId) {
        return new Promise(resolve => {
            if (merchantId == 'AAA111') {
                resolve(masterKey)

            } else {
                resolve(NativeHandler.getKey());
            }
        })
}

Here, NativeHandler is my JavaScriptHandler in the Native Activity.

Any help appreciated. Thanks.

Don’t instantiate promises like this. For one thing, you are swallowing errors.

1 Like

On reading the post, I figured I was using the incorrect technique for instantiating promises. Will implement the change and update you soon. Thanks.