aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <kriztan@users.noreply.github.com>2017-01-16 12:16:43 +0100
committerGitHub <noreply@github.com>2017-01-16 12:16:43 +0100
commit138f83a1c1845c80c921d5fddda6d9baebf65628 (patch)
tree95aa02745ff5e32caca7a50a21d5d5612af480a2 /src/main/java
parent4d4d8f98e9824f31eae2ce00af2b2b618243d87f (diff)
correct check if there is a scheduled pending intent
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 487a10045..fc5e1ba54 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3887,10 +3887,11 @@ public class XmppConnectionService extends Service {
public void ScheduleAutomaticExport() {
Intent intent = new Intent(this, AlarmReceiver.class);
- final PendingIntent ScheduleExportIntent = PendingIntent.getBroadcast(this, AlarmReceiver.SCHEDULE_ALARM_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+ intent.setAction("exportlogs");
// don't start export when app is restarted and an intent is already created
- if (ScheduleExportIntent != null) {
- Log.d(Config.LOGTAG, "Schedule automatic export logs. There is a pending intent " + ScheduleExportIntent.toString());
+ boolean ExportScheduled = (PendingIntent.getBroadcast(this, AlarmReceiver.SCHEDULE_ALARM_REQUEST_CODE, intent, PendingIntent.FLAG_NO_CREATE) != null);
+ if (ExportScheduled) {
+ Log.d(Config.LOGTAG, "Schedule automatic export logs. There is a pending intent scheduled.");
return;
}
//start export log service every day at given time
@@ -3901,7 +3902,7 @@ public class XmppConnectionService extends Service {
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY, Config.ExportLogs_Hour);
calendar.set(Calendar.MINUTE, Config.ExportLogs_Minute);
- intent.setAction("exportlogs");
+ final PendingIntent ScheduleExportIntent = PendingIntent.getBroadcast(this, AlarmReceiver.SCHEDULE_ALARM_REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
((AlarmManager) getSystemService(ALARM_SERVICE)).setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, ScheduleExportIntent);
}
}