DrewDahlman / Phonegap-LocalNotification

An example of how to use the LocalNotification plugin for Phonegap
86 stars 48 forks source link

phonegap 3.0 check plugin mapping #18

Open hunchang opened 11 years ago

hunchang commented 11 years ago

I'm new and try to create an app with the plugin. I setup phonegap 3.0 based on phonegap documentation, and tried to import your plugin based on the guide, but got this error when calling the function.

ERROR: Plugin ‘LocalNotification’ not found, or is not a CDVPlugin. Check your plugin mapping in config.xml

[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [ "LocalNotification1130323922", "LocalNotification", "addNotification", [ 1374660909, "This is a local notification.", "", "beep.caf", 1 ] ]

Any idea on how to make it work? Thanks

BastienL commented 11 years ago

Hi hunchang,

Did you add the following lines to your config.xml file ?

<feature name="LocalNotification">
    <param name="ios-package" value="LocalNotification" />
</feature>

Make also sure that you've included the LocalNotification.h and .m files into Xcode.

hunchang commented 11 years ago

i'm a bit confuse now, I downloaded the latest file.

  1. drag & drop both LocalNotification.h & .m into Xcode plugin
  2. copied & linked cordova.localNotification.js in www folder
  3. config.xml included the above lines
  4. placed .caf in resources folder

And what is the next steps and how to call the function?

Thanks

DrewDahlman commented 11 years ago

It is called via Javascript in your app... see the documentation and or blog post.

hiattp commented 11 years ago

@hunchang did you figure this out? I'm also seeing the error:

ERROR: Plugin ‘LocalNotification’ not found, or is not a CDVPlugin. 
Check your plugin mapping in config.xml

I believe this is the same from issue #20 as well. I'm using cordova v3.0.6, is it supposed to be supported? Here is my Xcode directory structure:

screen shot 2013-08-16 at 12 04 01 pm

and my config.xml file looks like this:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.goodbye" version="0.0.1" xmlns="http://www.w3.org/ns/widgets"     xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>GoodBye</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@callback.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />

    <feature name="LocalNotification">
        <param name="ios-package" value="LocalNotification" />
    </feature>    
</widget>
BastienL commented 11 years ago

The plugin is working for me on iOS with PhoneGap 3.0.6 so it is supported.

The only difference I can see between my code and yours is that I saved my LocalNotification.h and .m in a sub-directory of the Plugins folder called "LocalNotification".

Does it work better when you create this directory and put the two files in?

hiattp commented 11 years ago

Hmm no that didn't help but its encouraging that you have it up and running. So there are three directories for this plugin: cordova, cordova2.3+ and phonegap. I've been using the files and instructions from cordova2.3+, which are you using? This cordova/phonegap naming issue is driving me crazy, btw.

If you are using the same files, any chance you could throw up a little boilerplate, or do you have your project open-sourced somewhere? I'd love to take a look at a working example.

hiattp commented 11 years ago

I'm not entirely sure what the issue was here, it might have something to do with the format of the config.xml file. Either way I created a new fork that supports the new plugin installation script and simplifies the whole process, @hunchang give it a shot if you didn't figure this out.

I also think we should make some effort to merge all this back into Olivier's original repo, @DrewDahlman I see why you split it up originally but maybe its time to put them back together? As a newcomer to Cordova the multiple names, versions and repos were super confusing.

DrewDahlman commented 11 years ago

@hiattp totally - when I took on rewriting and making the plugin I was heavily involved in Cordova and had a lot more time to devote to enhancing and working on the plugin, but I no longer have that time available.

Olive did a great job porting to current versions, there are some features that still need to be ported over to make it a consistent plugin.

I still think we should keep the old versions - even though cordova has grown and changed, I think having the record of the growth of the plugins and keeping them available to people who may still be using older versions.

DrewDahlman commented 11 years ago

On that note - has anyone done a new post about setup? I think we should do some overall cleanup of the repo and pass ownership if anyone wants to take that on. My original documentation is quite outdated at this point and I think we should do some updates to setup and process of installing...

hiattp commented 11 years ago

Agreed about keeping the old versions. My fork has updated setup documentation for 3.0 implementations (although I never figured out the audio piece). I won't ultimately be using this plugin much so I don't think I'll have the bandwidth to maintain it either, but I'm happy to help sorting out the docs and merging my 3.0 updates back into this repo if you have a vision for how it should be organized.

hunchang commented 11 years ago

Sorry for replying late, I managed to get it work, as for the audio part, it only work when the app is running background. @hiattp just check if your audio file is located inside the "resources" folder. Another thing is, should edit the config.xml at the root folder, not the one under "www" folder.

Will continue try out and insert some feedback.

hiattp commented 11 years ago

Yeah that was probably it, I was adding to the config.xml in the www directory. How irritating. The audio actually is working, I didn't know it was only in the background. I've updated the new readme.

DrewDahlman commented 11 years ago

Rock and roll.

I am going to do some updates to my stuff, update the readme and point to your repo. We should also update the cordova plugins repo readme as well to reference the different repos...

shi11 commented 11 years ago

just got this working, great stuff. just a reminder that you should update the readme for 3.0 so that people can find this fork...

alonlevi commented 11 years ago

I've been waiting for a 3.0 fix for this.. thanks! two small question :

  1. the callback functions works perfectly, unless the app is terminated. then the callback doesn't get received. any ideas why?
  2. is there any change you'll be submitting this to phone-gap build? ;) thnx.