When we are add some native code of android in ionic that time how can we call it through button in our ionic app

when we are add some native code of android in ionic that time how can we call it through button in our ionic app

You would need to create a custom cordova plugin in order to do this. You need to create a javascript component which creates the bridge from the Ionic interface and calls the native functionality (Java/Objective C)

Can you give me any example for this solution?

The best way to creating a custom Cordova plugin would be looking at how other cordovan plugins are built and then looking through the actual Cordova documentations for creating your own.

I’d take a look at this plugin:

And take note of the files they include. The main ones you’ll need are plugin.XML, a JS file in the www folder and then ios + android source codes in the src folder.

Then take a look at the Cordova docs which were pretty helpful for me when I built a few plugins of my own.

https://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/

If you need more assistance on this, you’ll need to provide me with some more info such as what are you trying to do on Android/iOS.

Finally, are you sure a plugin for what you’re trying to do doesn’t currently exist?

And don’t hesitate if you need any help. I’ve made several of my own plugins and I’ve modified quite a few to meet my own app requirements.

Cheers,
Danny

Ok Mr. @DaDanny Thank you :relaxed: