How to create PhoneGap plugin out of an android ap

2020-05-09 23:16发布

问题:

I am basically using this https://github.com/googlesamples/android-vision with a few changes and it works perfectly on my android device. Anyway, I would like to use it inside PhoneGap. The idea is to build the rest of the application in javascript/html/css and when pressed a specific button, start the android app.

Can this be done by someone who has never created a plugin before?

I would be grateful for any hint or tutorial on how to do it.

回答1:

Of course it depends of your dev skills but I created myself my first plugin two months ago without being a Phonegap/Cordova expert, I'm a Java developer since 15 years but the most important thing is your motivation.

You first have to develop your basic Cordova app: https://cordova.apache.org/docs/en/latest/guide/cli/index.html

Then your ressource to create a plugin will be here: https://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/index.html

You will have to create one or few Java files as an adapter between your web app and your Jar code.

I found that the documentation was not enough for my case but I googled and used some dev blog articles and found some StackOverflow questions to help me.

Good luck!