Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
8c8bec0
[google_maps] Set correct polyline width when building polylines. (#1…
KlausJokisuo Aug 7, 2019
e876d3e
[webview_flutter] Add an initialAutoMediaPlaybackPolicy setting (#1951)
amirh Aug 7, 2019
d515868
[Camera] Improved resolution presets (#1952)
Aug 8, 2019
9045614
[connectivity] update the connectivity readme to include info about c…
danwulff Aug 8, 2019
3aa087c
Fix bug in camera example. (#1958)
mehmetf Aug 8, 2019
6deda07
[shared_preferences] Allow getInstance() to be reentrant (#1961)
mehmetf Aug 8, 2019
b48dd36
[image_picker] Depend on AndroidX Core instead of Legacy Support v4 (…
ChristianKatzmann Aug 9, 2019
40ef139
[webview_flutter] Filter onChanged events for invalid displays (#1964)
amirh Aug 9, 2019
560694c
[webview_flutter] Fix double tap on resize issue (#1965)
Aug 10, 2019
95ba642
[multiple] Add licenses (#1908)
bparrishMines Aug 12, 2019
993f895
[android_alarm_manager] Added oneShotAt method to schedule a alarm at…
Afsar-Pasha Aug 12, 2019
2b2ca66
Request code needs to be below 2^16 for FragmentActivity (#1968)
mehmetf Aug 13, 2019
eb72787
google-services-maps v17.0.0 androidx compatible (#1941)
JamesMcIntosh Aug 13, 2019
3820fd5
[webview_flutter] Workaround display listeners bug on all Android ver…
amirh Aug 13, 2019
e2f0f2d
[firebase_auth] use long datatype for timestamps (iOS) (#1973)
ened Aug 13, 2019
759375a
[webview_flutter] Remove noisy log messages on iOS (#1978)
amirh Aug 14, 2019
05c6d01
[webview_flutter] Remove warnings regarding iOS9 SDK methods (#1976)
ened Aug 15, 2019
be0cfa3
[webview_flutter] Calling destroy on webview when flutter part is get…
charafau Aug 15, 2019
59eeaa8
[webview_flutter] Add a getTitle method to WebViewController (#1979)
amirh Aug 15, 2019
e4feab6
Revert "[webview_flutter] Add a getTitle method to WebViewController"…
amirh Aug 16, 2019
2daeaf2
[image_picker] Image picker rotation fix on iOS after scaling.
Aug 16, 2019
c8f0c27
[firebase_admob] Banner Ad Horizontal Positioning (#1925)
malsabbagh Aug 16, 2019
d8eed34
[webview_flutter] Add a comment asking to extend WebViewPlatformContr…
amirh Aug 16, 2019
61c39d1
[webview_flutter] Allow setting a custom HTTP User-Agent (#1920)
LuisThein Aug 16, 2019
4a7ddd2
[android_alarm_manager] Added ability to get id in the callback (#1985)
Afsar-Pasha Aug 19, 2019
1375af3
[google_maps_flutter]Marker drag event (#1702)
duzenko Aug 19, 2019
05c2505
[camera] Pause/resume video recording for Android (#1370)
huulbaek Aug 19, 2019
f31cb36
[google_maps_flutter] Allow (de-)serialization of CameraPosition (#1784)
duzenko Aug 20, 2019
a3f9ce7
[pathprovider] Fix fall through bug (#1993)
mehmetf Aug 20, 2019
f401ca1
[video_player] Fix deprecated member use (#1998)
collinjackson Aug 22, 2019
3ad2d1d
Remove Flutterfire plugins (moved to FirebaseExtended) (#1984)
collinjackson Aug 22, 2019
18352b2
[google_maps_flutter] Adds support for displaying the traffic layer (…
josh-burton Aug 23, 2019
7f37ed5
[video_player] Added `formatHint` to to override video format on Andr…
jtmcdole Aug 23, 2019
ffe12d4
Fix tests after breaking change https://github.com/flutter/flutter/pu…
mehmetf Aug 23, 2019
6b5e01b
[Image_picker] fix `retrieveImage` breakage, added tests. (#2010)
Aug 24, 2019
e168ef5
Fix unit test for sensors (#2009)
collinjackson Aug 24, 2019
5f60b5a
[google_sign_in] Use implementation rather than api dependencies for …
collinjackson Aug 26, 2019
f02aab8
[instrumentation_adapter] enable Firebase Test Lab Android testing (#…
collinjackson Aug 27, 2019
9a1a56f
[instrumentation_adapter] Update README instructions (#2022)
collinjackson Aug 27, 2019
c5ade10
Add instrumentation_adapter to CODEOWNERS (#2024)
collinjackson Aug 28, 2019
d7ad50b
[instrumentation_adapter] update boilerplate to use @Rule instead of …
collinjackson Aug 28, 2019
94290d9
[google_maps_flutter] Avoid unnecessary redraws (#1933)
ppicas Aug 28, 2019
b76fe5d
[android_intent] add flags option (#2000)
thanhdatvo Aug 28, 2019
406ec35
[in_app_purchase] Remove skipped driver test (#2027)
Aug 28, 2019
b47754c
[instrumentation_adapter] Update documentation about using androidx (…
Aug 29, 2019
a941127
[In_App_Purchase] Avoids possible NullPointerException with backgroun…
juliocbcotta Aug 29, 2019
cd40169
fix android crash when pausing or resuming video on APIs lower than 2…
juliocbcotta Aug 29, 2019
90aaca8
[Connectivity] add a method to request location on iOS (for iOS 13) (…
Aug 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[android_alarm_manager] Added oneShotAt method to schedule a alarm at…
… a given time (flutter#1947)
  • Loading branch information
Afsar-Pasha authored and bkonyi committed Aug 12, 2019
commit 993f895baa13d85ceb4c08aa24bb38230ca3bb86
4 changes: 4 additions & 0 deletions packages/android_alarm_manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.3

* Added `oneShotAt` method to run `callback` at a given DateTime `time`.

## 0.4.2

* Added support for setting alarms which work when the phone is in doze mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void registerWith(Registrar registrar) {
// alarmManagerPluginChannel is the channel responsible for receiving the following messages
// from the main Flutter app:
// - "AlarmService.start"
// - "Alarm.oneShot"
// - "Alarm.oneShotAt"
// - "Alarm.periodic"
// - "Alarm.cancel"
final MethodChannel alarmManagerPluginChannel =
Expand Down Expand Up @@ -125,7 +125,7 @@ public void onMethodCall(MethodCall call, Result result) {
PeriodicRequest periodicRequest = PeriodicRequest.fromJson((JSONArray) arguments);
AlarmService.setPeriodic(mContext, periodicRequest);
result.success(true);
} else if (method.equals("Alarm.oneShot")) {
} else if (method.equals("Alarm.oneShotAt")) {
// This message indicates that the Flutter app would like to schedule a one-time
// task.
OneShotRequest oneShotRequest = OneShotRequest.fromJson((JSONArray) arguments);
Expand Down
62 changes: 58 additions & 4 deletions packages/android_alarm_manager/lib/android_alarm_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,74 @@ class AndroidAlarmManager {
bool exact = false,
bool wakeup = false,
bool rescheduleOnReboot = false,
}) =>
oneShotAt(
DateTime.now().add(delay),
id,
callback,
alarmClock: alarmClock,
allowWhileIdle: allowWhileIdle,
exact: exact,
wakeup: wakeup,
rescheduleOnReboot: rescheduleOnReboot,
);

/// Schedules a one-shot timer to run `callback` at `time`.
///
/// The `callback` will run whether or not the main application is running or
/// in the foreground. It will run in the Isolate owned by the
/// AndroidAlarmManager service.
///
/// `callback` must be either a top-level function or a static method from a
/// class.
///
/// The timer is uniquely identified by `id`. Calling this function again
/// again with the same `id` will cancel and replace the existing timer.
///
/// If `alarmClock` is passed as `true`, the timer will be created with
/// Android's `AlarmManagerCompat.setAlarmClock`.
///
/// If `allowWhileIdle` is passed as `true`, the timer will be created with
/// Android's `AlarmManagerCompat.setExactAndAllowWhileIdle` or
/// `AlarmManagerCompat.setAndAllowWhileIdle`.
///
/// If `exact` is passed as `true`, the timer will be created with Android's
/// `AlarmManagerCompat.setExact`. When `exact` is `false` (the default), the
/// timer will be created with `AlarmManager.set`.
///
/// If `wakeup` is passed as `true`, the device will be woken up when the
/// alarm fires. If `wakeup` is false (the default), the device will not be
/// woken up to service the alarm.
///
/// If `rescheduleOnReboot` is passed as `true`, the alarm will be persisted
/// across reboots. If `rescheduleOnReboot` is false (the default), the alarm
/// will not be rescheduled after a reboot and will not be executed.
///
/// Returns a [Future] that resolves to `true` on success and `false` on
/// failure.
static Future<bool> oneShotAt(
DateTime time,
int id,
dynamic Function() callback, {
bool alarmClock = false,
bool allowWhileIdle = false,
bool exact = false,
bool wakeup = false,
bool rescheduleOnReboot = false,
}) async {
final int now = DateTime.now().millisecondsSinceEpoch;
final int first = now + delay.inMilliseconds;
final int startMillis = time.millisecondsSinceEpoch;
final CallbackHandle handle = PluginUtilities.getCallbackHandle(callback);
if (handle == null) {
return false;
}
final bool r = await _channel.invokeMethod<bool>('Alarm.oneShot', <dynamic>[
final bool r =
await _channel.invokeMethod<bool>('Alarm.oneShotAt', <dynamic>[
id,
alarmClock,
allowWhileIdle,
exact,
wakeup,
first,
startMillis,
rescheduleOnReboot,
handle.toRawHandle(),
]);
Expand Down
2 changes: 1 addition & 1 deletion packages/android_alarm_manager/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: android_alarm_manager
description: Flutter plugin for accessing the Android AlarmManager service, and
running Dart code in the background when alarms fire.
version: 0.4.2
version: 0.4.3
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/android_alarm_manager

Expand Down