Phonegap-LocalNotification icon indicating copy to clipboard operation
Phonegap-LocalNotification copied to clipboard

phonegap 3.0 check plugin mapping

Open hunchang opened this issue 12 years ago • 15 comments

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

hunchang avatar Jul 25 '13 08:07 hunchang

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.

BastienL avatar Aug 12 '13 14:08 BastienL

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

hunchang avatar Aug 14 '13 14:08 hunchang

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

DrewDahlman avatar Aug 14 '13 14:08 DrewDahlman

@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="[email protected]" 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>

hiattp avatar Aug 16 '13 16:08 hiattp

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?

BastienL avatar Aug 16 '13 17:08 BastienL

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 avatar Aug 16 '13 17:08 hiattp

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.

hiattp avatar Aug 17 '13 03:08 hiattp

@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 avatar Aug 17 '13 18:08 DrewDahlman

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

DrewDahlman avatar Aug 17 '13 18:08 DrewDahlman

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.

hiattp avatar Aug 17 '13 20:08 hiattp

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.

hunchang avatar Aug 18 '13 11:08 hunchang

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.

hiattp avatar Aug 18 '13 13:08 hiattp

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

DrewDahlman avatar Aug 18 '13 15:08 DrewDahlman

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

shi11 avatar Sep 22 '13 04:09 shi11

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.

alonlevi avatar Oct 20 '13 22:10 alonlevi