mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
fixed camera not being initialized on Android
This commit is contained in:
parent
46e2c8342f
commit
639ec6e9d4
1 changed files with 6 additions and 20 deletions
|
@ -251,26 +251,12 @@ class _WidgetsBindingObserver with WidgetsBindingObserver {
|
||||||
/// Revoking camera permissions results in app being killed both on Android and iOS
|
/// Revoking camera permissions results in app being killed both on Android and iOS
|
||||||
@override
|
@override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
switch (defaultTargetPlatform) {
|
if (state == AppLifecycleState.inactive) {
|
||||||
/// On Android opening a dialog results in [AppLifecycleState.inactive]
|
return;
|
||||||
case TargetPlatform.android:
|
}
|
||||||
if (_prevState == AppLifecycleState.inactive && state == AppLifecycleState.resumed) {
|
if (_prevState != state) {
|
||||||
return;
|
_prevState = state;
|
||||||
}
|
onLifecycleStateChanged(state);
|
||||||
_prevState = state;
|
|
||||||
onLifecycleStateChanged(state);
|
|
||||||
|
|
||||||
/// When coming from the app's settings iOS fires paused -> inactive -> resumed state which falls into this condition.
|
|
||||||
/// So the inactive state is skipped.
|
|
||||||
case TargetPlatform.iOS:
|
|
||||||
if (state == AppLifecycleState.inactive) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_prevState != state) {
|
|
||||||
_prevState = state;
|
|
||||||
onLifecycleStateChanged(state);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue