Fixed Location Permission issue on Android - 1

This commit is contained in:
2024-05-24 07:21:28 +09:00
parent 74f6a79a36
commit e55674e1b9
19 changed files with 376 additions and 330 deletions

View File

@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:geojson_vi/geojson_vi.dart';
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
@ -9,6 +10,7 @@ import 'package:rogapp/utils/const.dart';
class LocationService {
static Future<GeoJSONFeatureCollection?> loadLocationsFor(
String perfecture, String cat) async {
final IndexController indexController = Get.find<IndexController>();
@ -187,4 +189,16 @@ class LocationService {
}
return null;
}
static const platform = MethodChannel('location');
static Future<bool> isLocationServiceRunning() async {
try {
final bool isRunning = await platform.invokeMethod('isLocationServiceRunning');
return isRunning;
} catch (e) {
print("Failed to check if location service is running: $e");
return false;
}
}
}