浏览代码

More readable intervall settings.

Sebastián Katzer 12 年之前
父节点
当前提交
4510d61b31
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/android/LocalNotificationOptions.java

+ 5 - 4
src/android/LocalNotificationOptions.java

@@ -15,6 +15,7 @@ import java.util.Date;
 import org.apache.cordova.CordovaInterface;
 import org.json.JSONObject;
 
+import android.app.AlarmManager;
 import android.media.RingtoneManager;
 import android.net.Uri;
 
@@ -42,13 +43,13 @@ public class LocalNotificationOptions {
         id           = options.optString("id");
 
         if (repeat.equalsIgnoreCase("daily")) {
-            interval = 86400000;
+            interval = AlarmManager.INTERVAL_DAY;
         } else if (repeat.equalsIgnoreCase("weekly")) {
-            interval = 604800000;
+            interval = AlarmManager.INTERVAL_DAY*7;
         } else if (repeat.equalsIgnoreCase("monthly")) {
-            interval = 2678400000L; // 31 days
+            interval = AlarmManager.INTERVAL_DAY*31; // 31 days
         } else if (repeat.equalsIgnoreCase("yearly")) {
-            interval = 31536000000L;
+            interval = AlarmManager.INTERVAL_DAY*365;
         }
     }