Sana Joseph
Sana Joseph

Reputation: 1948

Phonegap Local Notification Plugin for Android

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

Upvotes: 2

Views: 4631

Answers (2)

Sorcerer
Sorcerer

Reputation: 874

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(); and give it the ...AlarmHelper(ctx)

Upvotes: 1

eomer
eomer

Reputation: 397

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

Upvotes: 5

Related Questions