aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt12
1 files changed, 2 insertions, 10 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
index b1f26d99..d296b5f3 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
@@ -172,11 +172,7 @@ const val NOTIFICATION_PERIODIC_JOB = 7
* returns false if an error occurs; true otherwise
*/
fun Context.scheduleNotifications(minutes: Long): Boolean {
- val scheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler?
- if (scheduler == null) {
- L.e("JobScheduler not found; cannot schedule notifications")
- return false
- }
+ val scheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler
scheduler.cancel(NOTIFICATION_PERIODIC_JOB)
if (minutes < 0L) return true
val serviceComponent = ComponentName(this, NotificationService::class.java)
@@ -198,11 +194,7 @@ const val NOTIFICATION_JOB_NOW = 6
* Run notification job right now
*/
fun Context.fetchNotifications(): Boolean {
- val scheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler?
- if (scheduler == null) {
- L.e("JobScheduler not found")
- return false
- }
+ val scheduler = getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler
val serviceComponent = ComponentName(this, NotificationService::class.java)
val builder = JobInfo.Builder(NOTIFICATION_JOB_NOW, serviceComponent)
.setMinimumLatency(0L)