Mahmoud Farahat
Mahmoud Farahat

Reputation: 5475

build a cordova plugin for android from source code

I'm a .Net developer and I've some basic information about java development , I'm developing a multi-device-hybrid-apps using visual studio and cordova.

I use a native plugin for push notifications PushPlugin , I want to do some changes in this plugin using java , i downloaded eclipse and ADT plugin .

actually my problem is in using eclipse not in understanding java code (what is project template in eclipse should i use to create android library ), I've created a new android project and added the PushPlugin code that I downloaded from GitHub , but "android project" is generating an android app not just a jar file to use as a cordova plugin.

What I want is to make some modifications in the plugin code and re-build it using eclipse to generate a new jar file.

please advice.

Upvotes: 1

Views: 652

Answers (1)

Mahmoud Farahat
Mahmoud Farahat

Reputation: 5475

ok i found a way to overcome this issue , It's mainly caused by my lack understanding to how cordova plugins works , so i decided to write steps , it may help someone who has few knowledge about java and cordova plugins.

to edit a downloaded (with source-code) plugin from github

  • you don't need to install eclipse at all.
  • you need to have some knowledge in java and android API
  • in visual studio navigate to your plugin source code under plugins folder , in this case it's \plugins\com.phonegap.plugins.PushPlugin\src\android\com\plugin\gcm
  • find the plugin starting class which will be a class extends CordovaPlugin
  • edit what you want in java code
  • now in order to re-build java code , you MUST Clean cordova project before making a new deploy.

That's all.

Upvotes: 1

Related Questions