Fix Android issues
This commit is contained in:
@ -167,6 +167,17 @@ class PermissionController {
|
||||
}
|
||||
|
||||
static Future<bool> showLocationDisclosure() async {
|
||||
if (Platform.isIOS) {
|
||||
return await _showLocationDisclosureIOS();
|
||||
} else if (Platform.isAndroid) {
|
||||
return await _showLocationDisclosureAndroid();
|
||||
} else {
|
||||
// その他のプラットフォームの場合はデフォルトの処理を行う
|
||||
return await _showLocationDisclosureIOS();
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> _showLocationDisclosureIOS() async {
|
||||
if (Get.context == null) {
|
||||
print('Context is null, cannot show dialog');
|
||||
return false;
|
||||
@ -214,6 +225,41 @@ class PermissionController {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> _showLocationDisclosureAndroid() async {
|
||||
return await showDialog<bool>(
|
||||
context: Get.overlayContext ?? Get.context ?? (throw Exception('No valid context found')),
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('位置情報の使用について'),
|
||||
content: const SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: <Widget>[
|
||||
Text('このアプリでは、以下の目的で位置情報を使用します:'),
|
||||
Text('• チェックポイントの自動チェックイン(アプリが閉じているときも含む)'),
|
||||
Text('• 移動履歴の記録(バックグラウンドでも継続)'),
|
||||
Text('• 現在地周辺の情報表示'),
|
||||
Text('\nバックグラウンドでも位置情報を継続的に取得します。'),
|
||||
Text('これにより、バッテリーの消費が増加する可能性があります。'),
|
||||
Text('同意しない場合には、アプリは終了します。'),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('同意しない'),
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('同意する'),
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
) ?? false;
|
||||
}
|
||||
|
||||
static void showPermissionDeniedDialog(String title,String message) {
|
||||
Get.dialog(
|
||||
AlertDialog(
|
||||
|
||||
Reference in New Issue
Block a user