Phonegap 3.0.0 - Can't get plugins to work

5,407 views
Skip to first unread message

Anders Pettersson

unread,
Jul 24, 2013, 5:07:29 PM7/24/13
to phon...@googlegroups.com
Hi,
I'm working on a simple app, and atm I'm just presenting a home screen (index.html). I want to include Notification so that I can makes some nice alerts, by using navigator.notification.alert(). But it seems that it never gets loaded.

I'm on a Mac using Xcode 4.6.3 and I've put this in my config.xml (the one directly under my project root):

    <plugins>
        <plugin name="Geolocation" value="CDVLocation" />
        <plugin name="Notification" value="CDVNotification" />
    </plugins>

But nothing happens when I try to call it from my index.html page. It looks like this:

<script>
    document.addEventListener("deviceready", onDeviceReady, false);

    function onDeviceReady() {
        navigator.notification.alert("Hello world", null, "Alert", "Done");
    }

</script>

Anyone have any clues?

Regards,
Anders Pettersson

Irfan Shirur

unread,
Jul 25, 2013, 1:07:37 AM7/25/13
to phon...@googlegroups.com
Even I am facing the same issue. Is that something wrong in the Phonegap 3.0 ?
Trying to access the device API not working.

Warm Regards
Mohammed Irfan


--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Warm Regards
Mohammed Irfan

Raymond Camden

unread,
Jul 25, 2013, 2:57:03 PM7/25/13
to phon...@googlegroups.com
You have to add the plugin via the command line. See my notes here: http://www.raymondcamden.com/index.cfm/2013/7/19/PhoneGap-30-Released--Things-You-Should-Know

Irfan Shirur

unread,
Jul 26, 2013, 12:49:02 AM7/26/13
to phon...@googlegroups.com
Hey it worked for me, now I am able to add the phoneGap API and as well as custom plugin for android. not tested for iOS.

I have one question why is the DeviceReady function not working for iOS ?

Warm Regards
Mohammed Irfan 

Raymond Camden

unread,
Jul 26, 2013, 10:02:22 AM7/26/13
to phon...@googlegroups.com
Did you forget to include phonegap.js?


You received this message because you are subscribed to a topic in the Google Groups "phonegap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phonegap/sZvUn3Ua-C8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phonegap+u...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
===========================================================================
Raymond Camden, Adobe Developer Evangelist

Email : raymon...@gmail.com
Blog : www.raymondcamden.com
Twitter: cfjedimaster

Anders Pettersson

unread,
Jul 26, 2013, 11:27:49 AM7/26/13
to phon...@googlegroups.com
Ah, I didn't know that. Been tearing my hair out over this one. Thanks a lot for the help! Will let you know if I get it working.

Regards,
Anders Pettersson

Anders Pettersson

unread,
Jul 26, 2013, 12:35:27 PM7/26/13
to phon...@googlegroups.com
Thanks a bunch! Got it working now!

Regards,
Anders Pettersson

Mamzelle ju

unread,
Jul 26, 2013, 4:46:42 PM7/26/13
to phon...@googlegroups.com
Tried to user camera and I got this error, someone know why?

'undefined' is not an object (evaluating 'navigator.camera.getPicture')

I installed the plugin by cli, something missing ?

Raymond Camden

unread,
Jul 26, 2013, 5:47:09 PM7/26/13
to phon...@googlegroups.com
Not sure. You did add the camera plugin, right? Not something else?

Mamzelle ju

unread,
Jul 28, 2013, 5:14:55 PM7/28/13
to phon...@googlegroups.com
Yup.


help will be appreciated


Le mercredi 24 juillet 2013 17:07:29 UTC-4, Anders Pettersson a écrit :

Raymond Camden

unread,
Jul 28, 2013, 10:25:54 PM7/28/13
to phon...@googlegroups.com
I noticed this in your code:

         <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
         <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>

This looks bad. It should only be one - probably just phonegap.js.

Mamzelle ju

unread,
Jul 29, 2013, 6:27:36 AM7/29/13
to phon...@googlegroups.com
Found the problem. The documentation isn't up-to-date.

We have now to include this in the config.xml

<widget>
       
<preference name="MySetting" value="true" />
       
<plugins>
           
<plugin name="Camera" value="org.apache.cordova.core.camera.camera" />
       
</plugins>
       
<access origin="*" />
       
<content src="index.html" />
   
</widget>

Shazron

unread,
Jul 29, 2013, 8:25:01 PM7/29/13
to phonegap
Also, 3.0 doesn't support <plugins>, only the <feature> tag in config.xml (if you are doing it manually)


Message has been deleted

Raymond Camden

unread,
Jul 30, 2013, 10:42:23 AM7/30/13
to phon...@googlegroups.com
And I'm confused. Do we have to tell config.xml this or is just running the CLI "enough"? I'm seeing that running the CLI is enough for some things, but not others (like globalization - see my other thread).


On Tuesday, July 30, 2013 9:41:37 AM UTC-5, Mamzelle ju wrote:
What is the right manner to tell in the config.xml to use camera ?

Mamzelle ju

unread,
Jul 30, 2013, 11:01:28 AM7/30/13
to phon...@googlegroups.com
The build seems to override the config.xml (tested on Mac OS X for BB10)

Need to have this finally otherwise plugin:
<feature name="Camera" value="Camera" />

Kaan Soral

unread,
Jul 31, 2013, 7:00:49 AM7/31/13
to phon...@googlegroups.com
geolocation also doesn't respond, I've tried adding a feature element to config.xml but no luck

Lee Davies

unread,
Jul 31, 2013, 8:28:32 AM7/31/13
to phon...@googlegroups.com
If you've moved *cordova.js* away from the root folder, such as */assets/cordova.js* then your plugin files will be *relative* to that folder.

For example, I had:

    /
   
- js
   
-- cordova
   
--- cordova.js
   
- plugins


Alls I had to do was move the plugins folder inside the "cordova" folder and it works, like so:

    /
   
- js
   
-- cordova
   
--- plugins
   
--- cordova.js

Mamzelle ju

unread,
Jul 31, 2013, 3:31:31 PM7/31/13
to phon...@googlegroups.com
What plaftorms do you use ?

Kaan Soral

unread,
Jul 31, 2013, 3:36:15 PM7/31/13
to phon...@googlegroups.com
Android only - for testing
easy testing - many problems :)

Daniel Morgan

unread,
Aug 8, 2013, 1:19:24 PM8/8/13
to phon...@googlegroups.com
This worked for me. Thank you!

CallMe EHIS

unread,
Mar 27, 2017, 10:19:01 AM3/27/17
to phonegap
mine work on my pc, but when i upload it on phonegap build, it won't work again.

Kerri Shotts

unread,
Mar 27, 2017, 10:58:43 AM3/27/17
to phonegap
Don't resurrect old threads. Create new threads instead. Cordova has changed quite a bit since 2013.

Furthermore, this forum isn't for PhoneGap Build. Please see the welcome text for this group for the link to Adobe's PhoneGap Build forums.


On Monday, March 27, 2017 at 9:19:01 AM UTC-5, CallMe EHIS wrote:
mine work on my pc, but when i upload it on phonegap build, it won't work again.

...
Reply all
Reply to author
Forward
0 new messages