How to communicate with a webview in an Android Hybrid app


I'm building Hybrid app application for Android, using Cordova & Ionic.

I have a webview inside my app, allowing users to search google from it.
I need to be able to communicate between the WebView and the Android program.

I'm adding a button to each page in the web view,
the button should know some details from my app,
and I want to know when the user clicked the button.

I tried looking online; but I couldn't find a decent explanation for this.
Already tried to save the info on local storage, but the local storage being deleted when moving between pages.

Appreciate any help on this!
omer dAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris Harte2015 Top Expert (Most Article Points)Commented:
To communicate with a webview you need a webviewclient but I don't know how, or if, these work with hybrid apps.

Here is the guide for the view client

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
omer dAuthor Commented:
you're right, I needed to do it native, no hybrid support for it..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Responsive Web

From novice to tech pro — start learning today.