-
-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(android_alarm_manager): Add Kotlin dependency and convert AlarmBr…
…oadcastReceiver class to Kotlin
- Loading branch information
1 parent
eeab903
commit 0052d3f
Showing
3 changed files
with
37 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
...d/src/main/java/dev/fluttercommunity/plus/androidalarmmanager/AlarmBroadcastReceiver.java
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...d/src/main/kotlin/dev/fluttercommunity/plus/androidalarmmanager/AlarmBroadcastReceiver.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
package dev.fluttercommunity.plus.androidalarmmanager | ||
|
||
import android.content.BroadcastReceiver | ||
import android.content.Context | ||
import android.content.Intent | ||
|
||
class AlarmBroadcastReceiver : BroadcastReceiver() { | ||
/** | ||
* Invoked by the OS when a timer goes off. | ||
* | ||
* The associated timer was registered in [AlarmService]. | ||
* | ||
* In Android, timer notifications require a [BroadcastReceiver] as the artifact that is | ||
* notified when the timer goes off. As a result, this method is kept simple, immediately | ||
* offloading any work to [AlarmService.enqueueAlarmProcessing]. | ||
* | ||
* This method is the beginning of an execution path that will eventually execute a desired | ||
* Dart callback function, as registered by the Dart side of the android_alarm_manager plugin. | ||
* However, there may be asynchronous gaps between [onReceive] and the eventual invocation | ||
* of the Dart callback because [AlarmService] may need to spin up a Flutter execution | ||
* context before the callback can be invoked. | ||
*/ | ||
override fun onReceive(context: Context, intent: Intent) { | ||
AlarmService.enqueueAlarmProcessing(context, intent) | ||
} | ||
} |