Add await and logs
This commit is contained in:
parent
020e265b56
commit
ac91613d77
4 changed files with 16 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:developer' as developer;
|
||||
|
||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:quick_actions/quick_actions.dart';
|
||||
|
|
@ -21,11 +22,12 @@ class _QuickActionsInitializerState extends State<QuickActionsInitializer> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
quickActions.initialize((shortcutType) async {
|
||||
FirebaseCrashlytics.instance.log('quick_action: $shortcutType');
|
||||
switch (shortcutType) {
|
||||
case 'start':
|
||||
bg.BackgroundGeolocation.start();
|
||||
await bg.BackgroundGeolocation.start();
|
||||
case 'stop':
|
||||
bg.BackgroundGeolocation.stop();
|
||||
await bg.BackgroundGeolocation.stop();
|
||||
case 'sos':
|
||||
try {
|
||||
await bg.BackgroundGeolocation.getCurrentPosition(samples: 1, persist: true, extras: {'alarm': 'sos'});
|
||||
|
|
@ -34,6 +36,7 @@ class _QuickActionsInitializerState extends State<QuickActionsInitializer> {
|
|||
}
|
||||
}
|
||||
if (mounted) {
|
||||
FirebaseCrashlytics.instance.log('quick_action_exit');
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue