简体   繁体   中英

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

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM