7

I am building a PhoneGap Build app and I will be requiring some plugins. I have followed the docs yet none are working. Since none of them are working I suppose it's a common problem. Here's the plugins in the config.xml file:

<!-- Plugins -->  
<gap:plugin name="org.apache.cordova.device" /> <!-- Device plugin -->  
<gap:plugin name="com.phonegap.plugin.statusbar" /> <!-- Status bar plugin -->  
<gap:plugin name="com.verso.cordova.clipboard" /> <!-- Clipboard plugin -->  
<gap:plugin name="com.chariotsolutions.cordova.plugin.keyboard_toolbar_remover" /> <!-- Keyboard toolbar removal plugin -->  
<gap:plugin name="org.apache.cordova.splashscreen" /> <!-- Splashscreen plugin -->  
<gap:plugin name="org.apache.cordova.vibration" /> <!-- Vibration plugin -->

Here's the links in the index.html file (if there's a problem my best guess is that it will be here):

<!-- PhoneGap Build -->  
<script src="phonegap.js"></script>  
<script src="device.js"></script>  
<script src="statusbar.js"></script>  
<script src="clipboard.js"></script>  
<script src="keyboard_toolbar_remover.js"></script>  
<script src="splashscreen.js"></script>  
<script src="vibration.js"></script>

None are working except the device plugin (firing the 'deviceready' event).

Here's some code from the javascript file:

document.addEventListener("deviceready", function(e) {  
   // Hiding the status bar as even the fullscreen preference in config.xml isn't working
    StatusBar.hide();  
    window.setTimeout(function() {   
        // Trying to hide the splash screen which also doesn't work (or even show) properly from config.xml
        navigator.splashscreen.hide();  
    }, 4000); 
}, "false");  

I tested this function with an alert and I can assure you that it does get called. Here's some more:

// This is for the clipboard plugin  
function handleCopyAndPaste() {  
    $(".copyButton").click(function() {  
        window.plugins.clipboard.copy($("#result").val());  
    });  
    $(".pasteButton").click(function() {  
        window.plugins.clipboard.paste(function (text) {   
            $("#convertThis").val(text);  
            convert();  
        });  
    });  
} 

This is for vibrations:

navigator.notification.vibrate(2500);

This is for hiding the keyboard toolbar once an input field called #convertThis has focus():

$("#convertThis").focus(function() {
    toolbar.hide()
});

I tried removing the js links in index.html yet still nothing. I also tried putting the plugin tags outside the widget tag in config.xml and... NOTHING! Weirdly enough, the plugins tab in PhoneGap Build dashboards says none are installed:

screenshot
(source: uzusoft.com)

If you can provide any help on the matter, please do! Also on the config.xml issues please.

UPDATE: I am currently using PhoneGap Build 3.1.0 is order to support iOS 7.

Community
  • 1
  • 1
Youssef Moawad
  • 2,846
  • 5
  • 28
  • 50
  • You need to do the following steps: 1. android plugin in native code (Android plugin) 2. html part for call function 3. write js function to call native code 4. configure plugin in config.xml where is your android native code. if you provide others can see thats the problem. see sample for how to use android plugin in the below link: http://stackoverflow.com/questions/19721772/android-sms-sending-using-phonegap-cordova-3-1/19721910#19721910 – power_scriptor Nov 09 '13 at 09:02
  • @power_scriptor I am not using PhoneGap locally... I am using PhoneGap Build and so I don't maintain native APIs and I can't write native code. All these plugins are plugins provided in the [PhoneGap Build Plugins](http://build.phonegap.com/plugins) page. Also I am building for all platforms not just Android. – Youssef Moawad Nov 09 '13 at 11:37
  • You should post your entire index.html page and config.xml, all the above code looks fine, so it must be somewhere else. – Red2678 Nov 09 '13 at 16:15
  • PS - can you get an alert after "deviceready" fires? – Red2678 Nov 09 '13 at 16:18
  • @Red2678 sorry for being late, the website was down. The deviceready event DOES fire! I do get the alert. Also my index.html page is empty as all elements are inserted through jQuery. – Youssef Moawad Nov 10 '13 at 06:49
  • PS: I am currently using PhoneGap Build 3.1.0 in order to support iOS 7. – Youssef Moawad Nov 10 '13 at 07:45

2 Answers2

3

I was able to fix this by realizing that I had made a mistake in config.xml file:

This: xmlns:gap = "http://phonegap.com/ns/1.0" was xmlns:gap = "http://phonegap.com/ns/3.1.0" as I thought this was necessary to use Cordova 3.1.0 but it doesn't really have anything to do with it.

Youssef Moawad
  • 2,846
  • 5
  • 28
  • 50
-2

Put the config.xml in the www directory. And then upload only www.zip on build.phone.com.