Преглед на файлове

Merge pull request #66 from interFace-dk/ongoing_option

Added ongoing option (android only)
Sebastián Katzer преди 12 години
родител
ревизия
d8af1e9b07
променени са 4 файла, в които са добавени 10 реда и са изтрити 3 реда
  1. 1 0
      README.md
  2. 5 1
      src/android/Options.java
  3. 3 2
      src/android/Receiver.java
  4. 1 0
      www/local-notification.js

+ 1 - 0
README.md

@@ -117,6 +117,7 @@ window.plugin.notification.local.add({
     sound:      String,  // A sound to be played
     json:       String,  // Data to be passed through the notification
     autoCancel: Boolean, // Setting this flag and the notification is automatically canceled when the user clicks it
+    ongoing:    Boolean, // Prevent clearing of notification (Android only)
     foreground: String,  // A javascript function to be called if the app is running
     background: String,  // A javascript function to be called if the app is in the background
 });

+ 5 - 1
src/android/Options.java

@@ -182,7 +182,7 @@ public class Options {
         if (resId == 0) {
             resId = getIcon();
         }
-        
+
         return options.optInt("smallIcon", resId);
     }
 
@@ -228,6 +228,10 @@ public class Options {
         return options.optBoolean("autoCancel", false);
     }
 
+    public Boolean getOngoing() {
+        return options.optBoolean("ongoing", false);
+    }
+
     /**
      * Gibt die zusätzlichen Daten als String an.
      */

+ 3 - 2
src/android/Receiver.java

@@ -130,7 +130,8 @@ public class Receiver extends BroadcastReceiver {
         .setSmallIcon(options.getSmallIcon())
         .setLargeIcon(icon)
         .setSound(options.getSound())
-        .setAutoCancel(options.getAutoCancel());
+        .setAutoCancel(options.getAutoCancel())
+        .setOngoing(options.getOngoing());
 
         setClickEvent(notification);
 
@@ -196,4 +197,4 @@ public class Receiver extends BroadcastReceiver {
             LocalNotification.webView.sendJavascript(js);
         }
     }
-}
+}

+ 1 - 0
www/local-notification.js

@@ -36,6 +36,7 @@ LocalNotification.prototype = {
             message:    '',
             title:      '',
             autoCancel: false,
+            ongoing:    false,
             badge:      0,
             id:         '0',
             json:       '',