Yan Yi
Posts: 0
Joined: Sat Jan 25, 2014 7:38 pm

Adding phonegap plugins

I have a android cordova plugin which provides various functions like connecting to wifi and getting wifi ssid. I am having some issues integrating the plugin into appery, even after reading this link:
http://docs.appery.io/documentation/u...
i.d. of plugin: com.example.wifi
name: WifiService
files: WifiService.java, wifi_service.js, plugin.xml

Steps I took to integrate plugin:
A. Added Android/MyProject/src/com/phonegap/plugins/wifiservice/WifiService.java

B. Added to Android/MyProject/res/xml/config.xml the following:
code
<feature name="WifiService">
<param name="android-package" value="com&#46;example&#46;wifi&#46;WifiService"/>
</feature>
/code
C. Added Android/MyProject/assets/www/files/resources/lib/plugins/com.example.wifi/www/wifi_service.js

D. Added Android/MyProject assets/www/files/resources/lib/plugins/cordova_plugins.js the following:
code
{"file": "plugins\com&#46;example&#46;wifi\www\wifi_service&#46;js",
"id": "com&#46;example&#46;wifi",
"clobbers": ["wifi_service"]}
/code

Questions:

  1. what do I put for "clobbers" in step D?

  2. I need to edit AndroidManifest.xml to add some android permissions, but could not find the file. Do I create a new folder ANDROID/WifiService/AndroidManifest.xml? (I realised that only the Barcode scanner plugin has a extra folder of its own as shown in the picture.)

  3. I also need to edit www/index.html to add code<script language = "javascript" type = "text/javascript" src = "wifi_service&#46;js"></script>/codebut index.html is not found. Do I create a new folder ANDROID/WifiService/assets/html/index.html?
    Image
    Thanks!

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Adding phonegap plugins

Hello,

Could you post the link to plugin which you are trying to add?

Yan Yi
Posts: 0
Joined: Sat Jan 25, 2014 7:38 pm

Adding phonegap plugins

Ok. Can I send the plugin to you in private?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Adding phonegap plugins

Hi Yan - yes, you can mail us to: a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

Adding phonegap plugins

Hello,

Here are the answers:

1) WifiService
2) AndroidManifest you can find on this path: ANDROID/appName/AndroidManifest.xml
3) All html files are in the folder WEB_RESOURCES

Yan Yi
Posts: 0
Joined: Sat Jan 25, 2014 7:38 pm

Adding phonegap plugins

Thanks Nikita.

I did the above steps but am still not able to get it working.
Below is one of the test code I have. On button click, run the following javascript to display wifi id:
codewindow&#46;plugins&#46;WifiService&#46;getID(function(response) {
Appery('list_label')&#46;text("Current wifi name : ", JSON&#46;stringify(response));
}); /code

First, I debugged by using chrome console. It showed codeUncaught TypeError: Cannot read property 'WifiService' of undefined /code

I also tried running the app on Android phone but the plugin is not working.

Could you tell me your steps to install the plugin? And also if my test javascript is correct.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Adding phonegap plugins

Hello!
Sorry, but adding 3rd party plugins is outside the scope of our support.
Please note that it won't work in browser (only on device), so you can ignore error in browser. Check again step by step if you've added plugin correctly. If it still doesn't work debug app using logcat.

Yan Yi
Posts: 0
Joined: Sat Jan 25, 2014 7:38 pm

Adding phonegap plugins

Okay, thanks!

Yan Yi
Posts: 0
Joined: Sat Jan 25, 2014 7:38 pm

Adding phonegap plugins

I have found the following link and it is very similar to what I am doing. https://getsatisfaction.com/apperyio/... (maybe you guys can publish screenshots of this plugin, with the file locations?)

Understand that adding 3rd party plugins is outside the scope of Appery's support, so I am just hoping for general tips on adding plugins based on the file structure and names. The file structure in Appery is quite different from Cordova, so I think that confuses lots of users.

Would really appreciate some guidance with this - I think I am quite close to solving it. I'll be more than happy to share the plugin with other Appery users when its done :)

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

Adding phonegap plugins

Hi,

We have only this documentation:
http://docs.appery.io/documentation/u...

You can debug your app with Weinre:
http://docs.appery.io/documentation/d...

Return to “Issues”