How to call native method android/ios using typeScript?

As in javaScript i create a instance on android webView , so that by using that instance i was able to call any method from android native with annotation as @JavascriptInterface.

So how to do this using typeScript?

You use Cordova plugins for that. Look at any of them to learn how they do it. You can also look at ionic Native plugins to see how you can make them nicer to use in Ionic itself, but that is not required.

I have added a custom cordova plugin template into my ionic project.Now how can i call method of that plugin bcoz i m not able to access the variable which i define in plugin.xml as below

    <clobbers target="MyCordovaPlugin" />

You have to tell the Typescript about that. The variable comes form the outside (global JS context), so it doesn’t know about it.

declare var MyCordovaPlugin: any;

after the imports of your .ts file should be enough in your case. Then just use in your code.

Thanks its working now.

Just one more question i want to use android native library but if i run the code the dependency which i included in gradle file is gone. so where i need to put that gradle dependency?

Sorry, no idea.

Please open a new topic for this question, include in the title that you are talking about a Cordova Plugin.

Can you point me to an example that does this please?