mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
* feat: Disable battery optimization on android * fix: Add permission to androidmanifestbase file * Increase the frequency of app running in background on aggressive mode * Revert the sync mode frequency [skip ci] * Fix translation * increase frequency to 1 hour --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
23 lines
731 B
Dart
23 lines
731 B
Dart
import 'package:flutter/services.dart';
|
|
|
|
const MethodChannel _channel = MethodChannel('com.cake_wallet/native_utils');
|
|
|
|
Future<void> requestDisableBatteryOptimization() async {
|
|
try {
|
|
await _channel.invokeMethod('disableBatteryOptimization');
|
|
} on PlatformException catch (e) {
|
|
print("Failed to disable battery optimization: '${e.message}'.");
|
|
}
|
|
}
|
|
|
|
Future<bool> isBatteryOptimizationDisabled() async {
|
|
try {
|
|
final bool isDisabled = await _channel.invokeMethod('isBatteryOptimizationDisabled') as bool;
|
|
print('It\'s actually disabled? $isDisabled');
|
|
return isDisabled;
|
|
} on PlatformException catch (e) {
|
|
print("Failed to check battery optimization status: '${e.message}'.");
|
|
return false;
|
|
}
|
|
}
|