Skip to content

Commit

Permalink
fix repeating interval for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMoriarty committed Aug 11, 2021
1 parent d2e4ddd commit 2143a7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void showLocalNotification(String message, String title, int interval, in

public void showRepeatingNotification(String message, String title, int interval, int tag, int repeat_duration) {
if(interval <= 0) return;
Log.d(TAG, "showRepeatingNotification: "+message+", "+Integer.toString(interval)+", "+Integer.toString(tag));
Log.d(TAG, "showRepeatingNotification: "+message+", "+Integer.toString(interval)+", "+Integer.toString(tag)+" Repeat after: "+Integer.toString(repeat_duration));
PendingIntent sender = getPendingIntent(message, title, tag);

Calendar calendar = Calendar.getInstance();
Expand All @@ -114,9 +114,9 @@ public void showRepeatingNotification(String message, String title, int interval

AlarmManager am = (AlarmManager)getActivity().getSystemService(getActivity().ALARM_SERVICE);
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), repeat_duration, sender);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), repeat_duration*1000, sender);
} else {
am.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), repeat_duration, sender);
am.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), repeat_duration*1000, sender);
}
}

Expand Down
2 changes: 1 addition & 1 deletion nativelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "local-notification",
"display_name": "Local/Push Notifications",
"description": "Local notification plugin for iOS/Android",
"version": "0.2.1",
"version": "0.2.2",
"license": "MIT",
"godot_version": "3.2.3",
"url": "https://github.com/DrMoriarty/godot-local-notification.git",
Expand Down

0 comments on commit 2143a7e

Please sign in to comment.