How to call capacitor method from host application(Native to native communication)?

I have multiple plugins but now I want to call some performance measurement methods from the plugin package, how I can call that directly from the host application? like for android onCreate/ ios viewDidLoad?

Same question here. How can one CapacitorJS plugin native code call another plugin native function?

Also by now I got some own Swift files for native functionality in the main App folder, next to AppDelegate.swift, can they call plugin native functions (and vice versa)?

You can call the plugin methods directly from the host application by using Capacitor’s native bridge.

For Android, you can call methods from your plugin in onCreate, and for iOS, you can do the same in viewDidLoad. This should allow your app to interact with the plugin’s functionality.

@nehakakar Can you please provide a sample code?

You need to get a reference to the plugin class and call the method just like any other native method. For Android, you can do this inside MainActivity or onCreate by accessing the plugin through the plugin manager or directly if it’s your own class. For example, if you have a plugin named PerformancePlugin, you can create an instance or call its static method from onCreate. For iOS, you can do something similar in viewDidLoad by importing the plugin class and calling its method. Just make sure the method you want to call is written in a way that it can be accessed natively, not just from JavaScript.