Phonegap Local Notification Plugin for Android



 



up vote 2 down vote favorite

3




I'm working on a "Reminders" application on Android using Phonegap[Cordova 2.2].

The user enters a specific date for his reminder and I'm supposed to notify him on time.

I used this plugin to Just show a notification in the status bar & they are working fine.

But I want the notifications to show at specific times. Is there some method to do it ?

I found this plugin that's supposed to do what I want but it's not working, it shows errors at :

import com.phonegap.api.Plugin;import com.phonegap.api.PluginResult;

The import com.phonegap.api.Plugin cannot be resolved

So, how can I fix this error ? I know it might be easy, but I never made native Android Apps before so I'm kind of confused.

Thanks




android  phonegap  cordova  uilocalnotification  statusbar




 

 

share | improve this question


Dec 4 '12 at 13:54






Sana Joseph
748 6 30




2 Answers



active oldest votes



up vote 4 down vote accepted


Looks like a difference between 2.0.0 and 2.2.0, and like the plugin needs updating.

import org.apache.cordova.api.CordovaPlugin;import org.apache.cordova.api.PluginResult;

This should give you a jumping off point: http://docs.phonegap.com/en/2.2.0/guide_plugin-development_android_index.md.html#Developing%20a%20Plugin%20on%20Android




 

 

share | improve this answer


Dec 4 '12 at 14:34






eomer
191 4




 



up vote 1 down vote


For the new Phonegap Release you must also change some stuff:

  1. The LocalNotification class must "extends CordovaPlugin" now
  2. Import classes like eomer says
  3. The execute method of LocalNotification.java must return a boolean now
  4. Change all return arguments that are affected (from PluginResult) to boolean of your choice
  5. Get the context in a new way 

ctx = this.cordova.getActivity();




share | improve this answer