diff --git a/android/app/build.gradle b/android/app/build.gradle
index e6b989d..d10fc75 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -32,7 +32,7 @@ def keystorePropertiesFile = rootProject.file('key.properties')
android {
namespace "com.sefer_driver"
- compileSdkVersion 34
+ compileSdk 34
ndkVersion flutter.ndkVersion
compileOptions {
@@ -47,19 +47,29 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
-
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId "com.sefer_driver"
+ applicationId = "com.sefer_driver"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
- minSdkVersion 23
- targetSdkVersion 34
- versionCode 63
- versionName '1.5.63'
- // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
+ minSdk = 23
+ targetSdk = flutter.targetSdkVersion
+ versionCode = 64
+ versionName = '1.5.64'
}
+// defaultConfig {
+// // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+// applicationId ="com.sefer_driver"
+// // You can update the following values to match your application needs.
+// // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
+// minSdkVersion= 23
+// targetSdk= 34
+// versionCode= 63
+// versionName ='1.5.63'
+// // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
+// }
+
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
@@ -84,5 +94,6 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// implementation platform('com.google.firebase:firebase-bom:32.1.1')
+ implementation 'com.stripe:paymentsheet:20.47.0'
}
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 18f7867..6a14f65 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -4,6 +4,7 @@
+
@@ -12,6 +13,7 @@
+
@@ -34,6 +36,8 @@
+
+
+
-
+ android:foregroundServiceType="location"
+ android:exported="false">
+
-
+ android:exported="false">
+
+
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index 8779c3f..1c40cd1 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,5 +1,5 @@
buildscript {
- ext.kotlin_version = '1.9.10'
+ ext.kotlin_version = '1.9.22'
repositories {
google()
mavenCentral()
diff --git a/lib/controller/functions/location_background_controller.dart b/lib/controller/functions/location_background_controller.dart
index 76f2da9..d901200 100644
--- a/lib/controller/functions/location_background_controller.dart
+++ b/lib/controller/functions/location_background_controller.dart
@@ -8,13 +8,19 @@ class LocationBackgroundController extends GetxController {
void onInit() {
super.onInit();
requestLocationPermission();
- configureBackgroundLocation();
}
Future requestLocationPermission() async {
var status = await Permission.locationAlways.status;
if (!status.isGranted) {
- await Permission.locationAlways.request();
+ status = await Permission.locationAlways.request();
+ }
+
+ if (status.isGranted) {
+ configureBackgroundLocation();
+ } else {
+ // Handle permission denial
+ print("Location permission denied");
}
}
@@ -25,29 +31,36 @@ class LocationBackgroundController extends GetxController {
icon: "@mipmap/ic_launcher",
);
- BackgroundLocation.setAndroidConfiguration(1000);
+ // Set the location update interval to 5 seconds
+ BackgroundLocation.setAndroidConfiguration(5000);
BackgroundLocation.startLocationService();
+
BackgroundLocation.getLocationUpdates((location) {
// Handle location updates here
+ print("Latitude: ${location.latitude}, Longitude: ${location.longitude}");
+ });
+
+ startBackLocation();
+ }
+
+ void startBackLocation() async {
+ Timer.periodic(const Duration(seconds: 5), (timer) async {
+ await getBackgroundLocation();
});
}
- startBackLocation() async {
- Timer.periodic(const Duration(seconds: 5), (timer) {
- getBackgroundLocation();
- });
- }
-
- getBackgroundLocation() async {
+ Future getBackgroundLocation() async {
var status = await Permission.locationAlways.status;
if (status.isGranted) {
- await BackgroundLocation.startLocationService(
- distanceFilter: 20, forceAndroidLocationManager: true);
- BackgroundLocation.setAndroidConfiguration(
- Duration.microsecondsPerSecond); // Set interval to 5 seconds
-
- BackgroundLocation.getLocationUpdates((location1) {});
+ // The location service is already started in configureBackgroundLocation
+ // No need to call startLocationService again
+ BackgroundLocation.getLocationUpdates((location) {
+ // Handle location updates here
+ print(
+ "Latitude: ${location.latitude}, Longitude: ${location.longitude}");
+ });
} else {
+ // Request permission if not granted
await Permission.locationAlways.request();
}
}
diff --git a/lib/splash_screen_page.dart b/lib/splash_screen_page.dart
index f1aecec..59ef7b1 100644
--- a/lib/splash_screen_page.dart
+++ b/lib/splash_screen_page.dart
@@ -18,7 +18,7 @@ class SplashScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
- Get.put(LocationBackgroundController());
+ // Get.put(LocationBackgroundController());
return Scaffold(
backgroundColor:
AppColor.secondaryColor, // Set your desired background color
diff --git a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart
index b7b86fa..7812d76 100644
--- a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart
+++ b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart
@@ -161,24 +161,24 @@ GetBuilder leftMainMenuCaptainIcons() {
),
),
),
- AnimatedContainer(
- duration: const Duration(microseconds: 200),
- width: controller.widthMapTypeAndTraffic,
- decoration: BoxDecoration(
- color: AppColor.secondaryColor,
- border: Border.all(color: AppColor.blueColor),
- borderRadius: BorderRadius.circular(15)),
- child: IconButton(
- onPressed: () async {
- Get.to(() => EgyptCardAI());
- },
- icon: const Icon(
- FontAwesome5.grin_tears,
- size: 29,
- color: AppColor.blueColor,
- ),
- ),
- ),
+ // AnimatedContainer(
+ // duration: const Duration(microseconds: 200),
+ // width: controller.widthMapTypeAndTraffic,
+ // decoration: BoxDecoration(
+ // color: AppColor.secondaryColor,
+ // border: Border.all(color: AppColor.blueColor),
+ // borderRadius: BorderRadius.circular(15)),
+ // child: IconButton(
+ // onPressed: () async {
+ // Get.to(() => EgyptCardAI());
+ // },
+ // icon: const Icon(
+ // FontAwesome5.grin_tears,
+ // size: 29,
+ // color: AppColor.blueColor,
+ // ),
+ // ),
+ // ),
],
)),
);
diff --git a/pubspec.lock b/pubspec.lock
index bc8cd4d..b849849 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -76,10 +76,11 @@ packages:
background_location:
dependency: "direct main"
description:
- name: background_location
- sha256: fbb83ceb8cefcc6793f0a362f12773c28fc290a5e2c76cb593ee592ec7b6cb32
- url: "https://pub.dev"
- source: hosted
+ path: "."
+ ref: master
+ resolved-ref: f90f62aad5481677a832486432ccbf84da3b6861
+ url: "https://github.com/dharmik-dalwadi-seaflux/background_location.git"
+ source: git
version: "0.13.0"
boolean_selector:
dependency: transitive
diff --git a/pubspec.yaml b/pubspec.yaml
index 35db6ad..e99ce52 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -56,7 +56,12 @@ dependencies:
# google_generative_ai: ^0.0.1-dev
vibration: ^1.8.4
wakelock_plus:
- background_location: ^0.13.0
+ # background_location: ^0.13.0
+ background_location:
+ git:
+ url: https://github.com/dharmik-dalwadi-seaflux/background_location.git
+ ref: master
+
record: ^5.0.5
dio: ^5.4.3+1
webview_flutter: ^4.7.0