Page 1 of 2

Adding phonegap plugins

Posted: Sun Mar 16, 2014 7:15 am
by Yan Yi

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!


Adding phonegap plugins

Posted: Sun Mar 16, 2014 10:12 am
by Igor

Hello,

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


Adding phonegap plugins

Posted: Sun Mar 16, 2014 3:25 pm
by Yan Yi

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


Adding phonegap plugins

Posted: Sun Mar 16, 2014 3:28 pm
by Illya Stepanov

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


Adding phonegap plugins

Posted: Mon Mar 17, 2014 6:48 am
by Nikita

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


Adding phonegap plugins

Posted: Mon Mar 17, 2014 7:20 pm
by Yan Yi

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.


Adding phonegap plugins

Posted: Mon Mar 17, 2014 8:55 pm
by Maryna Brodina

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.


Adding phonegap plugins

Posted: Mon Mar 17, 2014 9:22 pm
by Yan Yi

Okay, thanks!


Adding phonegap plugins

Posted: Tue Mar 18, 2014 12:30 pm
by Yan Yi

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 :)


Adding phonegap plugins

Posted: Wed Mar 19, 2014 8:40 am
by Nikita

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...